Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 404 test for trustless gateway CARs #131

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tests/trustless_gateway_car_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,30 @@ func TestTrustlessCarPathing(t *testing.T) {
InThatOrder(),
),
},
{
Name: "GET default CAR response for non-existing file",
Hint: `
CAR stream of a non-existing path must return 200 OK and all the blocks necessary
to traverse the path up to and including the parent of the first non-existing
segment of the path, in order to allow the client to verify that the request
path does not exist.
`,
Request: Request().
Path("/ipfs/{{cid}}/subdir/i-do-not-exist", subdirTwoSingleBlockFilesFixture.MustGetCidWithCodec(0x70)).
Query("format", "car"),
Response: Expect().
Status(200).
Body(
IsCar().
IgnoreRoots().
HasBlocks(
subdirTwoSingleBlockFilesFixture.MustGetCid(),
subdirTwoSingleBlockFilesFixture.MustGetCid("subdir"),
).
Exactly().
InThatOrder(),
),
},
}

RunWithSpecs(t, helpers.StandardCARTestTransforms(t, tests), specs.TrustlessGatewayCAR)
Expand Down
Loading