Empty body stops ReplyTo.#467
Conversation
|
/retest |
|
/assign @markfisher because I am slightly altering the behavior of ReplyTo. |
|
/assign @markfisher |
|
|
||
| // httpDoer is an interface for making HTTP requests. | ||
| type httpDoer interface { | ||
| Do(*http.Request) (*http.Response, error) |
There was a problem hiding this comment.
I think two things:
1- if you want to put an interface infront of the http client, you need to implement all the methods:
type Client
func (c *Client) Do(req *Request) (*Response, error)
func (c *Client) Get(url string) (resp *Response, err error)
func (c *Client) Head(url string) (resp *Response, err error)
func (c *Client) Post(url, contentType string, body io.Reader) (resp *Response, err error)
func (c *Client) PostForm(url string, data url.Values) (resp *Response, err error)
2 - the documentation says this: Generally Get, Post, or PostForm will be used instead of Do.
Which implies we are using it wrong and we should take a look at that.
There was a problem hiding this comment.
-
My understanding of Go-style is that we should be creating minimal interfaces. Why add those other methods if we don't use them? If we start using them in the future, then we can add the methods to the interface.
-
Post() doesn't allow control of the headers. So we use Do() instead.
|
/retest |
| ReplyTo: subscription.Spec.ReplyTo, | ||
| } | ||
| return b.dispatcher.DispatchMessage(message, subscriber, defaults) | ||
| return b.dispatcher.DispatchMessage(message, subscriber, subscription.Spec.ReplyTo, defaults) |
There was a problem hiding this comment.
So, we're in a bit of a wonky world right now since subscription should probably be using the one from eventing since that uses the new "approved to move forward" model. There it's Result?
There was a problem hiding this comment.
+1 yeah I wonder if we need to make a copy of bus and have it use the new world subscriptions.
There was a problem hiding this comment.
If we end up using the bus abstraction in the new model, then we probably should fork it. This PR is slightly modifying the DispatchMessage() interface, not really modifying anything in the bus abstraction, so I don't think it warrants copying yet.
There was a problem hiding this comment.
I tend to agree with @adamharwayne that we should change the existing bus code as little as possible. We want the old objects to continue working while we build the new ones.
|
/hold |
|
/cc @grantr |
|
/hold cancel This PR only modifies bus as a side effect of refactoring the DispatchMessage method signature. No functionality is being changed in bus itself. |
grantr
left a comment
There was a problem hiding this comment.
🎉 yay for increased coverage! Thanks @adamharwayne.
/approve
/lgtm
/hold
Holding for typo fix. Feel free to cancel.
| reply, err := d.executeRequest(destinationURL, message) | ||
| if err != nil { | ||
| return fmt.Errorf("Unable to complete request %v", err) | ||
| func (d *MessageDispatcher) DispatchMessage(message *Message, destination, replyTo string, defaults DispatchDefaults) error { |
There was a problem hiding this comment.
Talked with Adam offline about the signature change that moved defaults.ReplyTo into the positional parameter replyTo. He argued that replyTo is not actually a default since it's specific to each Subscription and is never overridden.
| ReplyTo: subscription.Spec.ReplyTo, | ||
| } | ||
| return b.dispatcher.DispatchMessage(message, subscriber, defaults) | ||
| return b.dispatcher.DispatchMessage(message, subscriber, subscription.Spec.ReplyTo, defaults) |
There was a problem hiding this comment.
I tend to agree with @adamharwayne that we should change the existing bus code as little as possible. We want the old objects to continue working while we build the new ones.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adamharwayne, grantr The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
The following is the coverage report on pkg/.
|
|
/hold cancel |
|
/lgtm |
* Unit tests for passthrough headers. * Unit tests. * Respond to PR comments. * Remove httpDoer and use an in-memory server instead. * Respond to PR comments. * Close the response body. * Respond to PR comments. * Nil response is an error. * Unit test improvements suggested by PR comments.
Proposed Changes
Release Note