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 [email protected].
To post to this group, send email to [email protected].
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/fda45bd2-d377-4080-a86f-5870bbbdd17d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to