[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[PATCH] Add containsHeader() testing in headers/
From: Sergey Jukov <sergey@total-knowledge.com>
---
ChangeLog | 3 +++
headers/headers.cpp | 6 ++++++
headers/headers.h | 3 +++
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0b24474..9062c51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Sergey Jukov <sergey@total-knowledge.com> Thu, 14 Sep 2006 18:30:00 -0800
+- Add containsHeader() testing in headers/
+
Sergey Jukov <sergey@total-knowledge.com> Thu, 14 Sep 2006 14:20:00 -0800
- Add attributes/ for testing work of request attributes
diff --git a/headers/headers.cpp b/headers/headers.cpp
index 4ce4327..4aef5d6 100644
--- a/headers/headers.cpp
+++ b/headers/headers.cpp
@@ -51,6 +51,12 @@ void HeadersServlet::service(servlet::Ht
} catch (servlet::ServletException e) {
out<<"\n"<<testHeaderName+" is not formatted correctly";
}
+ std::string respTestHeaderName = "X-Test-Header";
+ if(resp.containsHeader(respTestHeaderName)) {
+ out<<"\n"<<respTestHeaderName<<" is set";
+ } else {
+ out<<"\n"<<respTestHeaderName<<" is not set";
+ }
out<<"</PRE>";
renderFooter(out);
}
diff --git a/headers/headers.h b/headers/headers.h
index 3247dbf..2d10cb0 100644
--- a/headers/headers.h
+++ b/headers/headers.h
@@ -37,6 +37,9 @@ milliseconds since January 1, 1970 GMT,
included with the request. Throws IllegalArgumentException if the header value
can't be converted to a date.
Example provided for If-Modified-Since HTTP request header using testHeaders.pl
+It displays work of containsHeader(), returns true if the named response header
+has already been set, false otherwise. Example provided for X-Test-Header test
+header.
@author Ilya A. Volynets-Evenbakh
*/
--
1.4.2