Permalink
Browse files

add doc for new functions for manipulating #headers{} records

Commit cccc578 added new functions to yaws_api for manipulating #headers
records: set_header/2, set_header/3, get_header/2, and
delete_header/2. This commit adds the documentation.
  • Loading branch information...
1 parent d6e7d36 commit 8dd9f23ff8b055a8eb54db8bbc18090d862d7207 @vinoski vinoski committed Jun 27, 2012
Showing with 31 additions and 3 deletions.
  1. +31 −3 man/yaws_api.5
View
@@ -419,10 +419,35 @@ Url-encodes a string. All URLs in HTML documents must be URL encoded.
.TP
\fBreformat_header(H)\fR
-Returns a list of reformatted header values from a #header{}
+Returns a list of reformatted header values from a #headers{}
record. The return list is suitable for retransmit.
.TP
+\fBset_header(Headers, {Header, Value})\fR
+Sets header \fIHeader\fR with value \fIValue\fR in the #headers{} record
+\fIHeaders\fR, and returns a new #headers{} record. Using the atom
+\fIundefined\fR for \fIValue\fR effectively deletes the header, same as
+\fIdelete_header/2\fR.
+
+.TP
+\fBset_header(Headers, Header, Value)\fR
+Sets header \fIHeader\fR with value \fIValue\fR in the #headers{} record
+\fIHeaders\fR, and returns a new #headers{} record. Using the atom
+\fIundefined\fR for \fIValue\fR effectively deletes the header, same as
+\fIdelete_header/2\fR.
+
+.TP
+\fBget_header(Headers, Header)\fR
+Gets the value of header \fIHeader\fR from the #headers{} record
+\fIHeaders\fR and returns it. If the header isn't set, the atom
+\fIundefined\fR is returned.
+
+.TP
+\fBdelete_header(Headers, Header)\fR
+Deletes any value set for header \fIHeader\fR in the #headers{} record
+\fIHeaders\fR, and returns a new #headers{} record.
+
+.TP
\fBrequest_url(ARG)\fR
Return the url as requested by the client. Return value
is a #url{} record as defined in yaws_api.hrl
@@ -731,11 +756,14 @@ Sets the WWW-Authenticate: header.
All other headers must be added using the normal HTTP syntax.
Example:
-\fI{header, {"My-X-Header", "gadong"}}\fR of \fI{header, "My-X-Header: gadong"}\fR
+\fI{header, {"My-X-Header", "gadong"}}\fR or \fI{header, "My-X-Header: gadong"}\fR
+.TP
+\fB{header, {HeaderName, erase}}\fR
+Clears the header named \fIHeaderName\fR from the accumulated headers.
.TP
-\fB{allheaders, HeaderList}\fB
+\fB{allheaders, HeaderList}\fR
Will clear all previously accumulated headers and replace them.

0 comments on commit 8dd9f23

Please sign in to comment.