Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Conversation

huyphan
Copy link
Contributor

@huyphan huyphan commented Feb 19, 2019

Issue #30

Description of changes:

  • Returns all the headers via MultiValueHeaders field rather than Headers field. This allows lambda-based service to send multiple values for the same header -- one notable use case being "Set-Cookie".

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@sapessi sapessi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question

core/response.go Outdated
Body: output,
IsBase64Encoded: isBase64,
StatusCode: r.status,
MultiValueHeaders: textproto.MIMEHeader(r.headers),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use the MIMEHeader from textproto instead of the Header object from net/http? They are both aliases of map[string][]string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong reason for that. While browsing through Golang's source code I found that Header object from net/http basically reuses a lot of functions from MIMEHeader from textproto, and provides functionality I didn't need. (Ref: https://golang.org/src/net/http/header.go). Since I only needed a map[string][]string, I chose the lightweight one.

Now I think more of that, I don't think it improves performance yet increases confusion in code. I've reverted to use Header from net/http.

@huyphan huyphan force-pushed the multi-value-headers branch from 846a2b3 to d7b2b4e Compare February 19, 2019 20:13
@sapessi sapessi merged commit eb5a49d into awslabs:master Feb 19, 2019
@huyphan huyphan deleted the multi-value-headers branch February 19, 2019 23:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants