I'm starting a new thread related to the previous one regarding making a batch api request to Google's API. I keep getting "Bad Reqeust" responses from Google after making a batch API call (other calls work fine).
Looking at the api documentation for batch api requests <https://developers.google.com/gmail/api/guides/batch> it says each part of the multipart request should have a content length. Here is the example Google supplies: POST /batch/farm/v1 HTTP/1.1 Authorization: Bearer your_auth_token Host: www.googleapis.com Content-Type: multipart/mixed; boundary=batch_foobarbaz Content-Length: total_content_length --batch_foobarbaz Content-Type: application/http Content-ID: <item1:[email protected]> GET /farm/v1/animals/pony --batch_foobarbaz Content-Type: application/http Content-ID: <item2:[email protected]> PUT /farm/v1/animals/sheep Content-Type: application/json Content-Length: part_content_length If-Match: "etag/sheep" { "animalName": "sheep", "animalAge": "5" "peltColor": "green", } --batch_foobarbaz Content-Type: application/http Content-ID: <item3:[email protected]> GET /farm/v1/animals If-None-Match: "etag/animals" --batch_foobarbaz-- The requests I'm generating with mojolicious do not have the "part_content_length." Here's mine: POST /batch/gmail/v1 HTTP/1.1 Authorization: Bearer A_REAL_TOKEN_GOES_HERE Host: www.googleapis.com Accept-Encoding: gzip Content-Length: 120 User-Agent: Mojolicious (Perl) Content-Type: multipart/mixed; boundary=nS2CX --nS2CX Content-Type: application/http GET /gmail/v1/users/[email protected]/messages/165eb111fcf21503 --nS2CX-- My question is, does Mojolicious provide a way to automatically generate a content length header for these parts? If not, which parts of the message get counted toward this length and how do I calculate it (assuming UTF-8)? -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
