NewSuccessfulResponse creates a new AsyncResponse that wraps a single http.Response with a 200 status code and the provided body.
(body string)
| 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] { |
| 79 | return NewHTTPToAsyncResponse(&http.Response{ |
| 80 | StatusCode: http.StatusOK, |
| 81 | Status: http.StatusText(http.StatusOK), |
| 82 | Body: io.NopCloser(strings.NewReader(body)), |
| 83 | }) |
| 84 | } |
| 85 | |
| 86 | func (s syncResponse) Next(ctx context.Context) (combiner.PipelineResponse, bool, error) { |
| 87 | if err := ctx.Err(); err != nil { |