Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeHeaders ¶
MakeHeaders returns the headers for any response.
Every succesful response must retrurn at least these headers: - Content-Type (default: "application/json") - Access-Control-Allow-Origin (default: "*") - Access-Control-Allow-Credentials (default: "true")
For a normal success response, simply call xcr.RespHeaders():
return events.APIGatewayProxyResponse{ Body: string(bytes), Headers: xcr.RespHeaders(), StatusCode: http.StatusCreated}, nil
To return plain text instead of json, override the Content-Type header:
return events.APIGatewayProxyResponse{ Body: fmt.Sprintf("Hello from Stream. %s", time.Now().String()), Headers: MakeHeaders(map[string]string{"Content-Type": "text"}), StatusCode: 200}, nil
Types ¶
Click to show internal directories.
Click to hide internal directories.