diff --git a/go.mod b/go.mod index d406d812..1849eab2 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/services/resource_dereference_service.go b/services/resource_dereference_service.go index 9036e7ec..18c976b1 100644 --- a/services/resource_dereference_service.go +++ b/services/resource_dereference_service.go @@ -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) diff --git a/tests/integration/rest/resource/collection/positive_test.go b/tests/integration/rest/resource/collection/positive_test.go index c54d1a9c..6635376d 100644 --- a/tests/integration/rest/resource/collection/positive_test.go +++ b/tests/integration/rest/resource/collection/positive_test.go @@ -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",