Skip to content

Commit 7fef44c

Browse files
committed
headers
1 parent b83a512 commit 7fef44c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

content/building-blocks/headers.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,41 @@ title = "Headers"
44
weight = 40
55
+++
66

7+
A quick reference.
8+
9+
These functions have to be used in the context of a web request.
10+
11+
12+
## Set headers
13+
14+
Use `header-out` to set headers, like this:
15+
716
~~~lisp
817
(setf (hunchentoot:header-out "HX-Trigger") "myEvent")
918
~~~
19+
20+
This sets the header of the current request.
21+
22+
USe `headers-out` (plural) to get an association list of headers:
23+
24+
> An alist of the outgoing http headers not including the 'Set-Cookie', 'Content-Length', and 'Content-Type' headers. Use the functions HEADER-OUT and (SETF HEADER-OUT) to modify this slot.
25+
26+
## Get headers
27+
28+
Use the `header-in*` and `headers-in*` (plural) function:
29+
30+
Function: (header-in* name &optional (request *request*))
31+
32+
> Returns the incoming header with name NAME. NAME can be a keyword (recommended) or a string.
33+
34+
`headers-in*`:
35+
36+
Function: (headers-in* &optional (request *request*))
37+
38+
> Returns an alist of the incoming headers associated with the REQUEST object REQUEST.
39+
40+
## Reference
41+
42+
Find some more here:
43+
44+
- [https://common-lisp-libraries.readthedocs.io/hunchentoot/#headers-in_1](https://common-lisp-libraries.readthedocs.io/hunchentoot/#headers-in_1)

0 commit comments

Comments
 (0)