Skip to content

Commit 67d04cb

Browse files
authored
Merge pull request #30 from rokatyy/set-status-code
[Response] Add ability to set status code via interface
2 parents c049846 + 940d6e9 commit 67d04cb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

response.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ type ProcessingResult interface {
3333
// GetStatusCode returns the status code of the response
3434
GetStatusCode() int
3535

36+
// SetStatusCode allows setting the status code of the response
37+
SetStatusCode(int)
38+
3639
// GetBody returns the body of the response
3740
GetBody() interface{}
3841
}
@@ -65,6 +68,10 @@ func (r *Response) GetBody() interface{} {
6568
return r.Body
6669
}
6770

71+
func (r *Response) SetStatusCode(statusCode int) {
72+
r.StatusCode = statusCode
73+
}
74+
6875
type ResponseStream struct {
6976
body io.ReadCloser
7077
contentType string
@@ -143,6 +150,11 @@ func (s *ResponseStream) GetHeaders() map[string]interface{} {
143150
func (s *ResponseStream) GetStatusCode() int {
144151
return s.statusCode
145152
}
153+
154+
func (s *ResponseStream) SetStatusCode(statusCode int) {
155+
s.statusCode = statusCode
156+
}
157+
146158
func (s *ResponseStream) GetBody() interface{} {
147159
return s.body
148160
}

0 commit comments

Comments
 (0)