Skip to content

Commit 161509f

Browse files
committed
Fix tests
1 parent 1cdee92 commit 161509f

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
@@ -1099,7 +1099,7 @@ test "httpz: json response" {
10991099
try stream.writeAll("GET /test/json HTTP/1.1\r\nContent-Length: 0\r\n\r\n");
11001100

11011101
var buf: [200]u8 = undefined;
1102-
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));
1102+
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));
11031103
}
11041104

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

13611361
var buf: [200]u8 = undefined;
1362-
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));
1362+
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));
13631363
}
13641364

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

13701370
var buf: [200]u8 = undefined;
1371-
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));
1371+
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));
13721372
}
13731373

13741374
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)