1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

net.http: remove ending \r from response.status_msg, add more tests

This commit is contained in:
Delyan Angelov
2022-11-20 16:21:50 +02:00
parent aae63f5eb5
commit cb336c7dc7
3 changed files with 35 additions and 22 deletions

View File

@@ -36,7 +36,7 @@ pub fn (resp Response) bytestr() string {
// Parse a raw HTTP response into a Response object
pub fn parse_response(resp string) !Response {
version, status_code, status_msg := parse_status_line(resp.all_before('\n'))!
version, status_code, status_msg := parse_status_line(resp.all_before('\r\n'))!
// Build resp header map and separate the body
start_idx, end_idx := find_headers_range(resp)!
header := parse_headers(resp.substr(start_idx, end_idx))!