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

Keep original baseUrl (if it exist) when setting Content_Location in header #1319

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

basecade
Copy link
Contributor

When returning a resource with an existing baseUrl then keep it when setting Content_Location in the header.
This can happen when a service returns a resource that belongs on another service.

…setting Content_Location in the header.

This can happen when a service returns a resource that belongs on another service.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 75.784% when pulling 085ff1e on jasmdk:headerContentLocationKeepBaseUrl into f17fc4c on jamesagnew:master.

@basecade
Copy link
Contributor Author

I have added a test for the new code, so I'm not sure I understand why the coverage has descreased.

@jamesagnew
Copy link
Collaborator

I'm not sure I understand the purpose of this- Why would you want a server to return a resource and provide a content location that the server itself doesn't agree with? This feels likely to cause more bugs in user code than it fixes...

@basecade
Copy link
Contributor Author

basecade commented Jun 3, 2019

Hi James,

Thank you for your feedback!
Let me try and explain my scenario. I have two microservices. Service1 is responsible for Resouce1 and Service2 is responsible for Resource2.
Service1 has a custom operation on a PlainProvider that creates an instance of both Resource1 and Resource2. So internally the custom operation on Service1 is using the GenericClient to create an instance of Resource2 on Service2. When Resource2 is returned to the custom operation it has a baseUrl matching Service2 in the idElement because of the HEADER_CONTENT_LOCATION. This is fine because if reflects where Resource2 resides. But when returning Resource2 from Service1 the HEADER_CONTENT_LOCATION is set to Service1 eventhough it already have an explicit location specified in the baseUrl.

Then you can argue that Resource1 and Resource2 should be on the same service, but my hands are a bit tied by some customer requirements. This is why I need to keep the existing baseUrl if there is one.

Hope my explanation makes sense :)

Best Regards,
Anders Havn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants