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: Accept contentType params for DID URL Resolution [DEV-4722] #325

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/swaggo/files/v2 v2.0.0 // indirect
github.com/timewasted/go-accept-headers v0.0.0-20130320203746-c78f304b1b09 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
go.uber.org/multierr v1.10.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions services/resource_dereference_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ func (rds ResourceService) DereferenceResourceDataWithMetadata(did string, resou
context = types.ResolutionSchemaJSONLD
}

dereferenceMetadata.ContentType = types.ContentType(resource.Metadata.MediaType)

var result types.ContentStreamI
result = types.NewDereferencedResourceData(resource.Resource.Data)
metadata := types.NewDereferencedResource(did, resource.Metadata)
Expand Down
18 changes: 17 additions & 1 deletion tests/integration/rest/resource/collection/positive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,23 @@ var _ = DescribeTable("Positive: get collection of resources", func(testCase uti
testconstants.TestHostAddress,
testconstants.UUIDStyleTestnetDid,
),
ResolutionType: string(types.JSONLD) + ";profile=" + types.W3IDDIDRES,
ResolutionType: string(types.DIDJSONLD),
EncodingType: testconstants.DefaultEncodingType,
ExpectedEncodingType: "gzip",
ExpectedJSONPath: "../../testdata/collection_of_resources/metadata_did_ld.json",
ExpectedStatusCode: http.StatusOK,
},
),

Entry(
"can get collection of resources with an existent DID, and supported JSONLD resolution type",
utils.PositiveTestCase{
DidURL: fmt.Sprintf(
"http://%s/1.0/identifiers/%s/metadata",
testconstants.TestHostAddress,
testconstants.UUIDStyleTestnetDid,
),
ResolutionType: string(types.JSONLD),
EncodingType: testconstants.DefaultEncodingType,
ExpectedEncodingType: "gzip",
ExpectedJSONPath: "../../testdata/collection_of_resources/metadata.json",
Expand Down
Loading