Skip to content

Commit 6f4487d

Browse files
committed
Fix tests
1 parent 563afa2 commit 6f4487d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/httpz.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ test "httpz: json response" {
11111111
try stream.writeAll("GET /test/json HTTP/1.1\r\nContent-Length: 0\r\n\r\n");
11121112

11131113
var buf: [200]u8 = undefined;
1114-
try t.expectString("HTTP/1.1 201 \r\nContent-Type: application/json\r\nContent-Length: 26\r\n\r\n{\"over\":9000,\"teg\":\"soup\"}", testReadAll(stream, &buf));
1114+
try t.expectString("HTTP/1.1 201 \r\nContent-Type: application/json; charset=UTF-8\r\nContent-Length: 26\r\n\r\n{\"over\":9000,\"teg\":\"soup\"}", testReadAll(stream, &buf));
11151115
}
11161116

11171117
test "httpz: query" {
@@ -1371,7 +1371,7 @@ test "httpz: custom dispatch without action context" {
13711371
try stream.writeAll("GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n");
13721372

13731373
var buf: [200]u8 = undefined;
1374-
try t.expectString("HTTP/1.1 200 \r\nContent-Type: application/json\r\ndstate: 10\r\ndispatch: TestHandlerDispatch\r\nContent-Length: 12\r\n\r\n{\"state\":10}", testReadAll(stream, &buf));
1374+
try t.expectString("HTTP/1.1 200 \r\nContent-Type: application/json; charset=UTF-8\r\ndstate: 10\r\ndispatch: TestHandlerDispatch\r\nContent-Length: 12\r\n\r\n{\"state\":10}", testReadAll(stream, &buf));
13751375
}
13761376

13771377
test "httpz: custom dispatch with action context" {
@@ -1380,7 +1380,7 @@ test "httpz: custom dispatch with action context" {
13801380
try stream.writeAll("GET /?name=teg HTTP/1.1\r\nContent-Length: 0\r\n\r\n");
13811381

13821382
var buf: [200]u8 = undefined;
1383-
try t.expectString("HTTP/1.1 200 \r\nContent-Type: application/json\r\ndstate: 20\r\ndispatch: TestHandlerDispatchContext\r\nContent-Length: 12\r\n\r\n{\"other\":30}", testReadAll(stream, &buf));
1383+
try t.expectString("HTTP/1.1 200 \r\nContent-Type: application/json; charset=UTF-8\r\ndstate: 20\r\ndispatch: TestHandlerDispatchContext\r\nContent-Length: 12\r\n\r\n{\"other\":30}", testReadAll(stream, &buf));
13841384
}
13851385

13861386
test "httpz: custom handle" {

src/testing.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub const Testing = struct {
6666

6767
pub fn expectJson(self: Response, expected: anytype) !void {
6868
if (self.headers.get("Content-Type")) |ct| {
69-
try t.expectString("application/json", ct);
69+
try t.expectString("application/json; charset=UTF-8", ct);
7070
} else {
7171
return error.NoContentTypeHeader;
7272
}

0 commit comments

Comments
 (0)