HTTP helpers in util.http
The util.http
utility provides helper methods that you can use to manage
HTTP request parameters and to add response headers.
-
util.http.copyHeaders(headers)
-
Copies the header from the map without the restricted set of HTTP headers. You can use this to forward request headers to your downstream HTTP endpoint.
util.http.addResponseHeader(String, Object)
-
Adds a single custom header with the name (
String
) and value (Object
) of the response. The following limitations apply:-
Header names can't match any of the existing or restricted AWS or AWS AppSync headers.
-
Header names can't start with restricted prefixes, such as
x-amzn-
orx-amz-
. -
The size of custom response headers can't exceed 4 KB. This includes header names and values.
-
You should define each response header once per GraphQL operation. However, if you define a custom header with the same name multiple times, the most recent definition appears in the response. All headers count towards the header size limit regardless of naming.
-
util.http.addResponseHeaders(Map)
-
Adds multiple response headers to the response from the specified map of names (
String
) and values (Object
). The same limitations listed for theaddResponseHeader(String, Object)
method also apply to this method.