* swarm/api: url scheme bzz-hash to get hashes of swarm content (#15238) Update URI to support bzz-hash scheme and handle such HTTP requests by responding with hash of the content as a text/plain response. * swarm/api: return hash of the content for bzz-hash:// requests * swarm/api: revert "return hash of the content for bzz-hash:// requests" Return hashes of the content that would be returned by bzz-raw request. * swarm/api/http: handle error in TestBzzGetPath * swarm/api: remove extra blank line in comment
This commit is contained in:
committed by
Péter Szilágyi
parent
5258785c81
commit
542d51895f
@ -29,6 +29,7 @@ func TestParseURI(t *testing.T) {
|
||||
expectRaw bool
|
||||
expectImmutable bool
|
||||
expectList bool
|
||||
expectHash bool
|
||||
expectDeprecatedRaw bool
|
||||
expectDeprecatedImmutable bool
|
||||
}
|
||||
@ -98,6 +99,16 @@ func TestParseURI(t *testing.T) {
|
||||
uri: "bzz://abc123/path/to/entry",
|
||||
expectURI: &URI{Scheme: "bzz", Addr: "abc123", Path: "path/to/entry"},
|
||||
},
|
||||
{
|
||||
uri: "bzz-hash:",
|
||||
expectURI: &URI{Scheme: "bzz-hash"},
|
||||
expectHash: true,
|
||||
},
|
||||
{
|
||||
uri: "bzz-hash:/",
|
||||
expectURI: &URI{Scheme: "bzz-hash"},
|
||||
expectHash: true,
|
||||
},
|
||||
{
|
||||
uri: "bzz-list:",
|
||||
expectURI: &URI{Scheme: "bzz-list"},
|
||||
@ -152,6 +163,9 @@ func TestParseURI(t *testing.T) {
|
||||
if actual.List() != x.expectList {
|
||||
t.Fatalf("expected %s list to be %t, got %t", x.uri, x.expectList, actual.List())
|
||||
}
|
||||
if actual.Hash() != x.expectHash {
|
||||
t.Fatalf("expected %s hash to be %t, got %t", x.uri, x.expectHash, actual.Hash())
|
||||
}
|
||||
if actual.DeprecatedRaw() != x.expectDeprecatedRaw {
|
||||
t.Fatalf("expected %s deprecated raw to be %t, got %t", x.uri, x.expectDeprecatedRaw, actual.DeprecatedRaw())
|
||||
}
|
||||
|
Reference in New Issue
Block a user