It seems that the payload was not the problem.  The problem is that the 
request from the taskqueue comes in as an unsecured connection (HTTP 
instead of HTTPS), which was being rejected by our app.

On Wednesday, March 2, 2016 at 11:22:27 PM UTC+1, JohnGB wrote:
>
> I'm using Go, and I'm trying to place a task on the taskqueue which has 
> some JSON encoded content in the body.  However, I seem to be getting 301 
> responses, and it seems to be related to the Task.Payload.
>
> The code that I'm using is structurally as the code below, with `am` being 
> a struct with working JSON tags:
>
>
> func QueueAdminMessage(ctx context.Context, am adminMessage) error {
>
> // Encode the admin message.
> rawMsg, err := json.Marshal(am)
> if err != nil {
> return err
> }
>
> task := &taskqueue.Task{
> Path:    endpoints.SendAdminMessage,
> Payload: rawMsg,
> Method:  "POST",
> }
>
> newTask, err := taskqueue.Add(ctx, task, "admin-messaging")
> if err != nil {
> return err
> }
> log.Debugf(ctx, "New Task:\n  Path: %s\n  Payload:%s", newTask.Path, 
> string(newTask.Payload))
> return nil
> }
>
> This seems to add a task to the taskqueue, but the task constantly fails 
> (with a 301 response).  My guess is that I'm not setting the Payload up 
> correctly, but I can't find very much on how to specify a body content with 
> the payload.  The documentation states (in reference to the Payload):
>
>     // Payload is the data for the task.
>     // This will be delivered as the HTTP request body.
>     // It is only used when Method is POST, PUT or PULL.
>     // url.Values' Encode method may be used to generate this for POST 
> requests.
>
>
> It says that the url.Values Encode method *may* be used, but not that it 
> *must* be used.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/840392c5-18be-4e15-b216-31a8e27527c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to