NewBadRequest creates a new AsyncResponse that wraps a single http.Response with a 400 status code and the provided error message.
(err error)
| 67 | |
| 68 | // NewBadRequest creates a new AsyncResponse that wraps a single http.Response with a 400 status code and the provided error message. |
| 69 | func NewBadRequest(err error) Responses[combiner.PipelineResponse] { |
| 70 | return NewHTTPToAsyncResponse(&http.Response{ |
| 71 | StatusCode: http.StatusBadRequest, |
| 72 | Status: http.StatusText(http.StatusBadRequest), |
| 73 | Body: io.NopCloser(strings.NewReader(err.Error())), |
| 74 | }) |
| 75 | } |
| 76 | |
| 77 | // NewSuccessfulResponse creates a new AsyncResponse that wraps a single http.Response with a 200 status code and the provided body. |
| 78 | func NewSuccessfulResponse(body string) Responses[combiner.PipelineResponse] { |