allow streams in the post-data tuple
parent
8c5c973116
commit
376f332eef
|
@ -34,6 +34,8 @@ IN: http.client
|
||||||
|
|
||||||
GENERIC: >post-data ( object -- post-data )
|
GENERIC: >post-data ( object -- post-data )
|
||||||
|
|
||||||
|
M: f >post-data ;
|
||||||
|
|
||||||
M: post-data >post-data ;
|
M: post-data >post-data ;
|
||||||
|
|
||||||
M: string >post-data
|
M: string >post-data
|
||||||
|
@ -41,15 +43,13 @@ M: string >post-data
|
||||||
"application/octet-stream" <post-data>
|
"application/octet-stream" <post-data>
|
||||||
swap >>data ;
|
swap >>data ;
|
||||||
|
|
||||||
M: byte-array >post-data
|
|
||||||
"application/octet-stream" <post-data>
|
|
||||||
swap >>data ;
|
|
||||||
|
|
||||||
M: assoc >post-data
|
M: assoc >post-data
|
||||||
"application/x-www-form-urlencoded" <post-data>
|
"application/x-www-form-urlencoded" <post-data>
|
||||||
swap >>params ;
|
swap >>params ;
|
||||||
|
|
||||||
M: f >post-data ;
|
M: object >post-data
|
||||||
|
"application/octet-stream" <post-data>
|
||||||
|
swap >>data ;
|
||||||
|
|
||||||
: normalize-post-data ( request -- request )
|
: normalize-post-data ( request -- request )
|
||||||
dup post-data>> [
|
dup post-data>> [
|
||||||
|
@ -63,8 +63,10 @@ M: f >post-data ;
|
||||||
normalize-post-data ;
|
normalize-post-data ;
|
||||||
|
|
||||||
: write-post-data ( request -- request )
|
: write-post-data ( request -- request )
|
||||||
dup method>> [ "POST" = ] [ "PUT" = ] bi or
|
dup method>> { "POST" "PUT" } member? [
|
||||||
[ dup post-data>> data>> write ] when ;
|
dup post-data>> data>> dup sequence?
|
||||||
|
[ write ] [ output-stream get stream-copy ] if
|
||||||
|
] when ;
|
||||||
|
|
||||||
: write-request ( request -- )
|
: write-request ( request -- )
|
||||||
unparse-post-data
|
unparse-post-data
|
||||||
|
|
Loading…
Reference in New Issue