File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11Copyright (C) 2012-2013 by Moodstocks SAS
2- Copyright (C) 2014-2022 by Pierre Chapuis
2+ Copyright (C) since 2014 by Pierre Chapuis
33
44Permission is hereby granted, free of charge, to any person obtaining a copy
55of this software and associated documentation files (the "Software"), to deal
Original file line number Diff line number Diff line change @@ -68,6 +68,15 @@ rq.url = "http://httpbin.org/post"
6868local b , c , h = http .request (rq )
6969```
7070
71+ Example setting extra headers (here Authorization):
72+
73+ ``` lua
74+ local rq = mp .gen_request ({myfile = {name = " myfilename" , data = " some data" }})
75+ rq .url = " http://httpbin.org/post"
76+ rq .headers .Authorization = " Bearer SomeToken42"
77+ local b , c , h = http .request (rq )
78+ ```
79+
7180## Bugs
7281
7382Non-ASCII part names are not supported.
@@ -91,5 +100,5 @@ Note that non-ASCII file names are supported since version 1.2.
91100
92101## Copyright
93102
94- - Copyright (c) 2012- 2013 Moodstocks SAS
95- - Copyright (c) 2014-2022 Pierre Chapuis
103+ - Copyright (c) 2012 - 2013 Moodstocks SAS
104+ - Copyright (c) since 2014 Pierre Chapuis
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ T:start("gen_request"); do
3333 },
3434 foo = " bar" ,
3535 }
36+ rq .headers .Authorization = " Bearer SomeToken42"
3637
3738 rq .url = " http://httpbin.org/post"
3839 rq .sink = ltn12 .sink .table (r )
@@ -47,6 +48,7 @@ T:start("gen_request"); do
4748 ltn12file = " ltn12 data"
4849 })
4950 T :eq (r .form , {foo = " bar" })
51+ T :eq (r .headers .Authorization , " Bearer SomeToken42" )
5052end ; T :done ()
5153
5254T :start (" encode" ); do
You can’t perform that action at this time.
0 commit comments