Hi!
Please, provide a code example (with any paste service, like
gist.github.com), so we can see how you create request object and give
you advice.
On 18/09/2018 19:50, Steve Dondley wrote:
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: Beareryour_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:12930...@barnyard.example.com>
GET /farm/v1/animals/pony
--batch_foobarbaz
Content-Type: application/http
Content-ID: <item2:12930...@barnyard.example.com>
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:12930...@barnyard.example.com>
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:BearerA_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/sdond...@gmail.com/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 mojolicious+unsubscr...@googlegroups.com
<mailto:mojolicious+unsubscr...@googlegroups.com>.
To post to this group, send email to mojolicious@googlegroups.com
<mailto:mojolicious@googlegroups.com>.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.