Google App Engine respond with the code 308

226 Views Asked by At

Problem

1.I have a sns service which is running on Google App Engine

2.The sns service is using go to run as the back ending side

3.The sns service is using a crob job to request Api A

4.The Api A is adding another http request(request to Api B) into taskqueue

5.The taskqueue is executed immediately after the request of Api A

6.The request of Api B is executed

7.The Api B responded with the code 308

Problem Summary

job cron(request for Api A) -> Api A -> Task queue(stack request for Api B) ->Api B -> some execution

Api A responded with 200 Api B responded with 308

Question

Why Api B is respond with the code of 308?

Complement


By the way the following sequence is successful

post man (request for Api A) -> Api A -> Task queue(request for Api B) ->Api B -> some execution

Api A responded with 200 Api B responded with 200

When I use post man to request Api A the following request for Api B was respond with 200

The way I did with taskqueue is like

    params := url.Values{}
    params.Set("dollSpaces", strings.Join(dollSpaces, ","))
    t := taskqueue.NewPOSTTask("/path", params)
    req.Header.Set("X-AppEngine-QueueName", "mailqueue")
    c := appengine.NewContext(req)
    taskqueue.Add(c, t, "my queue")

The Log from Google Cloud Platform is like the following

Response of Api A

2019-01-01 10:00:00.001 JST
GET
200
193 B
577 ms
AppEngine-Google; (+http://code.google.com/appengine)
/path/ApiAPath
 0.1.0.1 - - [01/Jan/2019:10:00:00 +0900] "GET /path/ApiAPath HTTP/1.1" 200 193 - "AppEngine-Google; (+http://code.google.com/appengine)" "aaa.aaa.com" ms=577 cpu_ms=3 cpm_usd=2.8039999999999998e-8 loading_request=0 instance=asda1231313asdasd123123asda123 app_engine_release=1.9.71 trace_id=123123123dsfasf123123zafasdasd

Response of Api B

2019-01-01 10:00:00.100 JST
POST
308
95 B
2 ms
AppEngine-Google; (+http://code.google.com/appengine)
/ApiBPath

0.1.0.2 - - [01/Jan/2019:10:00:00 +0900] "POST /ApiBPath HTTP/1.1" 308 95 http://aaa.aaa.com/path/ApiAPath "AppEngine-Google; (+http://code.google.com/appengine)" "aaa.aaa.com" ms=2 cpu_ms=221 cpm_usd=1.3802e-8 loading_request=0 instance= asda1231313asdasd123123asda123 app_engine_release=1.9.71 trace_id= 123123123dsfasf123123zafasdasd
0

There are 0 best solutions below