From e73cc20a33c7bd2bb5dc6d759e75309568836f53 Mon Sep 17 00:00:00 2001 From: gammazero <11790789+gammazero@users.noreply.github.com> Date: Fri, 3 Jan 2025 12:17:34 -1000 Subject: [PATCH] Expect all URL escapes to use uppercase hex --- docs/test-dsl-syntax.md | 4 ++-- tests/dnslink_gateway_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/test-dsl-syntax.md b/docs/test-dsl-syntax.md index 3fb6ad797..04c94f083 100644 --- a/docs/test-dsl-syntax.md +++ b/docs/test-dsl-syntax.md @@ -10,7 +10,7 @@ for non-GO developers that want to read or contribute tests. golang's default string formating package is similar to C. Format strings might look like `"this is a %s"` where `%s` is a verb that will be replaced at runtime. -These verbs collides with URL-escaping a lot, strings like `/ipfs/Qm.../%c4%85/%c4%99` might trigger weird errors. We implemented a minimal templating library that is used almost everywhere in the test. +These verbs collides with URL-escaping a lot, strings like `/ipfs/Qm.../%C4%85/%C4%99` might trigger weird errors. We implemented a minimal templating library that is used almost everywhere in the test. It uses `{{name}}` as a replacement for `%s`. Other verbs are not supported. @@ -28,7 +28,7 @@ Fmt(`Etag: W/"{{etag-value}}"`, "weak-key") // => "ETag: W/\"weak-key\"" It is required to always provide a meaningful `{{name}}`: ```golang -Fmt(`/ipfs/{{cid}}/%c4%85/%c4%99`, fixture.myCID) // => "/ipfs/Qm..../%c4%85/%c4%99" +Fmt(`/ipfs/{{cid}}/%C4%85/%C4%99`, fixture.myCID) // => "/ipfs/Qm..../%C4%85/%C4%99" ``` Values are replaced in the order they are defined, and you may reuse named values diff --git a/tests/dnslink_gateway_test.go b/tests/dnslink_gateway_test.go index adbc9c023..15023b2e9 100644 --- a/tests/dnslink_gateway_test.go +++ b/tests/dnslink_gateway_test.go @@ -42,7 +42,7 @@ func TestDNSLinkGatewayUnixFSDirectoryListing(t *testing.T) { Response: Expect(). Status(301). Headers( - Header("Location").Equals(`/%c4%85/%c4%99/`), + Header("Location").Equals(`/%C4%85/%C4%99/`), ), }, {