api - How to construct a multipart form request and POST it using the Squeak/Smalltalk WebClient -


i trying upload image twitter-api, requires multipart/form-data oauth-signed post request. there seems kind of mistake in code, i'm getting 503 errors everytime try call function. should "temporarily unavailable" error, constant on different times of day , apparently other people had same problem uploading media via twitter-api.

following examples found, building multipart header this:

postdata := '--', boundary, string crlf,             'content-disposition: form-data; filename="upload.png"; name="media"', string crlf,             'content-type: image/png', string crlf,             'content-transfer-encoding: base64', string crlf,             morphasbinarystring, string crlf,             '--', boundary,'--', string crlf. 

the actual httppost command goes this:

request := client httppost: url          content: postdata         type: 'multipart/form-data; boundary=', boundary         do:[:req | webutils oauthsign: req url: url extra: using: personaloauthparams]. 

is correct approach? in advance help.

update: turns out there string crlf missing in line before media data. getting "authentication required" error. other api-calls work without problem.


Comments