elixir-google-api
elixir-google-api copied to clipboard
Cloud Tasks - body stripped away from %GoogleApi.CloudTasks.V2.Model.AppEngineHttpRequest{}
Hi,
I am creating an AppEngineHttpRequest:
defp create_gae_request(uri, start, limit),
do: %GoogleApi.CloudTasks.V2.Model.AppEngineHttpRequest{
httpMethod: "POST",
relativeUri: uri,
headers: %{"Content-Type" => "application/json"}
body: %{"start" => start, "limit" => limit} |> Jason.encode!() |> Base.url_encode64(padding: true)
}
The inspection correctly shows:
%GoogleApi.CloudTasks.V2.Model.AppEngineHttpRequest{
appEngineRouting: nil,
body: "eyJsaW1pdCI6MTAsInN0YXJ0IjowfQ==",
headers: %{"Content-Type" => "application/json"},
httpMethod: "POST",
relativeUri: "/tasks/fetch_messages"
}
But when I create the task, the resulting struct shows and empty body:
{:ok,
%GoogleApi.CloudTasks.V2.Model.Task{
appEngineHttpRequest: %GoogleApi.CloudTasks.V2.Model.AppEngineHttpRequest{
appEngineRouting: %GoogleApi.CloudTasks.V2.Model.AppEngineRouting{
host: redacted,
instance: nil,
service: nil,
version: nil
},
body: nil,
headers: %{
"Content-Length" => "22",
"Content-Type" => "application/json",
"User-Agent" => "AppEngine-Google; (+http://code.google.com/appengine)"
},
httpMethod: "POST",
relativeUri: "/tasks/fetch_messages"
},
createTime: ~U[2020-03-11 07:59:23Z],
dispatchCount: nil,
dispatchDeadline: nil,
firstAttempt: nil,
httpRequest: nil,
lastAttempt: nil,
name: redacted,
responseCount: nil,
scheduleTime: ~U[2020-03-11 07:59:23.644602Z],
view: "BASIC"
}}
and clearly the tasks returns 400 since the url accepts a body which is not being sent.
Am I missing something ?