fix: use full encoded topic iri in streaming http receiveFrom url template#1935
Conversation
joachimvh
left a comment
There was a problem hiding this comment.
Good catch. I added some minor comments I should have caught the first time actually.
| const resourcePath = input.metadata.identifier.value.replace(this.baseUrl, ''); | ||
| const receiveFrom = `${this.baseUrl}${this.pathPrefix}${resourcePath}`; | ||
| const encodedUrl = encodeURIComponent(input.metadata.identifier.value); | ||
| const receiveFrom = `${this.baseUrl}${this.pathPrefix}${encodedUrl}`; |
There was a problem hiding this comment.
I missed this last time, but when generating URLs you want to use the joinUrl utility function instead of concatenating strings. This reduces the chance of errors, if someone didn't add a slash to the end of their base URL for example.
Also if baseUrl only gets used like this you could just store joinUrl(baseUrl, pathPrefix) in a variable in the constructor instead of storing both separately and combining every time.
There was a problem hiding this comment.
Thanks for the review, I added the changes! Since now it only appends the full URL to the end; I could define an InteractionRoute in the config and pass it to both components.
📁 Related issues
✍️ Description
I tried streaming HTTP notifications with the subdomain identifier strategy, which, of course, didn't work.
By using the topic's fully encoded IRI now, it should not assume any specific identifier strategy.
✅ PR check list
Before this pull request can be merged, a core maintainer will check whether