Last active
December 5, 2022 18:37
-
-
Save tomfa/a78954ca5307477e1d5bde3baf2222c3 to your computer and use it in GitHub Desktop.
Demo desired ability in Apollo Router Rhai plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn process_response(response) { | |
response.headers["set-cookie"] = "foo=bar; Domain=localhost; Path=/; Expires=Wed, 04 Jan 2023 17:25:27 GMT; HttpOnly; Secure; SameSite=None"; | |
// This overwrites the first header set above | |
response.headers["set-cookie"] = "foo2=bar2; Domain=localhost; Path=/; Expires=Wed, 04 Jan 2023 17:25:27 GMT; HttpOnly; Secure; SameSite=None"; | |
// This does not work | |
response.headers["set-cookie"] = [ | |
"foo=bar; Domain=localhost; Path=/; Expires=Wed, 04 Jan 2023 17:25:27 GMT; HttpOnly; Secure; SameSite=None", | |
"foo2=bar2; Domain=localhost; Path=/; Expires=Wed, 04 Jan 2023 17:25:27 GMT; HttpOnly; Secure; SameSite=None", | |
]; | |
} | |
fn supergraph_service(service) { | |
const response_callback = Fn("process_response"); | |
service.map_response(response_callback); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment