Report this

What is the reason for this report?

Getting JSON post request body in App Platform serverless Go function

Posted on November 12, 2022

I have an App Platform instance with serverless Go functions as below

type Request struct {
	JWT string `json:"jwt"`
}

type Response struct {
	StatusCode int               `json:"statusCode,omitempty"`
	Headers    map[string]string `json:"headers,omitempty"`
	Body       string            `json:"body,omitempty"`
}

func Login(in Request) (*Response, error) {
    ...
}

the Request type seems to only be URL parameters when I try to use it.

Is there any way to get the body of the post request or headers?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.