Merge pull request 'refactor: migrated to Response.body' (#229) from Chewing_Bever/vieter:dev into dev

Reviewed-on: vieter/vieter#229
Jef Roosens 2022-06-05 22:47:21 +02:00
commit 5df5850044
2 changed files with 6 additions and 6 deletions

View File

@ -66,5 +66,5 @@ fn (c &Client) send_request_with_body<T>(method Method, url string, params map[s
fn (c &Client) send_request_raw_response(method Method, url string, params map[string]string, body string) ?string {
res := c.send_request_raw(method, url, params, body)?
return res.text
return res.body
}

View File

@ -25,12 +25,12 @@ pub const (
http_302 = http.new_response(
status: .found
text: '302 Found'
body: '302 Found'
header: headers_close
)
http_400 = http.new_response(
status: .bad_request
text: '400 Bad Request'
body: '400 Bad Request'
header: http.new_header(
key: .content_type
value: 'text/plain'
@ -38,7 +38,7 @@ pub const (
)
http_404 = http.new_response(
status: .not_found
text: '404 Not Found'
body: '404 Not Found'
header: http.new_header(
key: .content_type
value: 'text/plain'
@ -46,7 +46,7 @@ pub const (
)
http_500 = http.new_response(
status: .internal_server_error
text: '500 Internal Server Error'
body: '500 Internal Server Error'
header: http.new_header(
key: .content_type
value: 'text/plain'
@ -209,7 +209,7 @@ pub fn (mut ctx Context) send_response_to_client(mimetype string, res string) bo
mut resp := http.Response{
header: header.join(web.headers_close)
text: res
body: res
}
resp.set_version(.v1_1)
resp.set_status(ctx.status)