-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabled HEAD requests + refactoring #31
Conversation
deberth
commented
Nov 21, 2016
- enabled head requests
- refactored servehttp method from composition handler
- go format
* refactored servehttp method from composition handler * go format
if res.Content.HttpStatusCode() >= 300 && res.Content.HttpStatusCode() <= 308 { | ||
copyHeaders(res.Content.HttpHeader(), w.Header(), ForwardResponseHeaders) | ||
w.WriteHeader(res.Content.HttpStatusCode()) | ||
if agg.handleForwardingRequests(res, w, r) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is IMO not self explaining: what's about handle30xResponses()
w.WriteHeader(res.Content.HttpStatusCode()) | ||
io.Copy(w, res.Content.Reader()) | ||
res.Content.Reader().Close() | ||
if agg.handleRequestsWithBody(res, w, r) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, I would suggest the name: handleStreamResponses
It would also be a good idea to put both cases within the loop in one method with the name:
handleNonMergeableResponses()
@@ -83,31 +81,83 @@ func (agg *CompositionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) | |||
} | |||
} | |||
|
|||
status := 200 | |||
status := agg.extractStatusCode(results, w, r) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this function name is missleading, because the basic work it does is to copy the headers.
Maybe the two things: Extraction of the status code and copy the header should be done in separate steps.
* go format
Cool, looks very clean and understandable, now! |