MM-13606 Remove consumeAndClose and clean up integration response handling (#10066)
* MM-13606 Remove consumeAndClose * Allow overriding HTTPService's request timeout * MM-13606 Clean up integration response handling * Properly close httptest servers * Address feedback * Only call buf.Bytes when necessary * Properly check for errors in doOutgoingWebhookRequest * Add comment explaining ignored ioutil.ReadAll errors
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e67fe4c89d
Коммит
1a3ccaf305
@@ -109,10 +109,10 @@ func (o *OutgoingWebhookResponse) ToJson() string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func OutgoingWebhookResponseFromJson(data io.Reader) *OutgoingWebhookResponse {
|
||||
func OutgoingWebhookResponseFromJson(data io.Reader) (*OutgoingWebhookResponse, error) {
|
||||
var o *OutgoingWebhookResponse
|
||||
json.NewDecoder(data).Decode(&o)
|
||||
return o
|
||||
err := json.NewDecoder(data).Decode(&o)
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (o *OutgoingWebhook) IsValid() *AppError {
|
||||
|
||||
@@ -202,7 +202,7 @@ func TestOutgoingWebhookResponseJson(t *testing.T) {
|
||||
o.Text = NewString("some text")
|
||||
|
||||
json := o.ToJson()
|
||||
ro := OutgoingWebhookResponseFromJson(strings.NewReader(json))
|
||||
ro, _ := OutgoingWebhookResponseFromJson(strings.NewReader(json))
|
||||
|
||||
if *o.Text != *ro.Text {
|
||||
t.Fatal("Text does not match")
|
||||
|
||||
Ссылка в новой задаче
Block a user