Fix serverSync to use apiProxy logic in the same way the clientSync does #256
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Formerly the
serverSyncmethod insyncer.jsused thedataAdapterto request data from an api host. This is a problem as e.g. thex-forward-forheader is only set in theapiProxy. TheserverSyncmethod should work the same way as theclientSyncmethod which already uses theapiProxy.We extracted the proxy request logic to a reusable method
proxyRequeststored in theapiProxyMiddleware. Additionally we added theresobject to the globalappobject in the same way thereqobject is already being added to it, to allow a customapiProxymaking use of theresobject.One additional advantage would be the decoupling of the
dataAdapterfrom thesyncerwhich e.g. makes it simple to implement support for multipledataAdapters (e.g. for REST and for SOAP).CC: @c089, @selaux, @lo1tuma