     normalize-post-data ;
 
 : write-post-data ( request -- request )
-    dup method>> [ "POST" = ] [ "PUT" = ] bi or
-    [ dup post-data>> data>> write ] when ; 
+    dup method>> { "POST" "PUT" } member?  [
+        dup post-data>> data>> dup sequence?
+        [ write ] [ output-stream get stream-copy ] if
+    ] when ; 
 
 : write-request ( request -- )
     unparse-post-data


GENERIC: >post-data ( object -- post-data )

M: post-data >post-data ;

M: string >post-data

    "application/octet-stream" <post-data>
        swap >>data ;

M: assoc >post-data
    "application/x-www-form-urlencoded" <post-data>
        swap >>params ;

M: object >post-data
    "application/octet-stream" <post-data>
        swap >>data ;

: normalize-post-data ( request -- request )
    dup post-data>> [
