Skip to content

Commit c18e839

Browse files
committed
add headers example
1 parent 8d63b3b commit c18e839

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

examples/request_headers.nim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import curly
2+
3+
let curl = newCurly()
4+
5+
var headers: HttpHeaders
6+
headers["Accept-Encoding"] = "gzip"
7+
8+
# Blocks until the request completes
9+
let response = curl.get(
10+
"https://en.wikipedia.org/wiki/Special:Random",
11+
headers,
12+
timeout = 10
13+
)
14+
15+
echo response.code
16+
echo response.url

0 commit comments

Comments
 (0)