I'm trying to configure a transformer for an endpoint with parameters.
I successfully configured transformers for endpoints that don't include any parameters. But it seems that when I try to do the same for Resource with parameters it won't work.
This is how I configure transformer:
var getExampleData: Resource { return resource(exampleDataEndpoint) }
configureTransformer(getExampleData) {
try jsonDecoder.decode(ExampleDataResponse.self, from: $0.content)
}
And this is how I send the request:
Api.getExampleData.withParam("foo", "bar").addObserver(self).loadIfNeeded()
I get the response but it never goes thru the transformer pipeline.
Response: 200 ← GET http:example.com/enpoint?foo=bar
Siesta:pipeline │ [thread ᎠᏔᎼᎼ] └╴Response after pipeline: success: 28 bytes
EDIT
Tested the .withParam() method on transforms that work fine and it seems like the URL has to be the same in order to Siesta transformers work, it's a bummer.
Different query strings mean different URLs, and different URLs mean different Siesta resources:
Thus:
So when you do this:
…that applies only to
getExampleData, not to any variations with different params.If you want configuration to apply to all resources that share a path, match on the path: