我试图通过改造将图片上传到PushBullet API。
upload-request之后我解雇了分段上传。
通过改造,我收到了这个错误:
{"error":{"code":"invalid_request","type":"invalid_request","message":"Invalid multipart body.","cat":"o(^・x・^)o"},"error_code":"invalid_request"}
问题只出现在我的java代码中,而不是PAW HTTP-Client。
# PAW generated Request
POST /upload-legacy/bcSWXnBjNIwpkej7CxfIHFz0ugXO6yhf HTTP/1.1
Content-Type: multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__
Host: upload.pushbullet.com
Connection: close
User-Agent: Paw/3.0.12 (Macintosh; OS X/10.11.6) GCDHTTPRequest
Content-Length: 34508
--__X_PAW_BOUNDARY__
Content-Disposition: form-data; name="file"; filename="cat.jpg"
Content-Type: image/jpeg
...
# Retrofit generated Request
POST https://upload.pushbullet.com/upload-legacy/ZZ4fLcqt2WFQmlbKTDlgcYXtB3KiCs3M http/1.1
Content-Type: multipart/form-data; charset=utf-8
Content-Length: 2012
Content-Disposition: form-data; name="file"; filename="1475501429665_motion_detected.jpg"
Content-Type: image/jpeg; charset=utf-8
Content-Length: 1772
...
我认为重要的区别是Content-Length
中的Part
。
我发现这个issue,但这意味着PushBullet API不符合HTTP规范?
任何帮助都将不胜感激。