createHttpProxy API
These docs are auto-generated from typings files (
*.d.ts
).
createHttpProxy
Creates an HTTP Proxy that can be used to intercept requests made with the HTTP service.
function createHttpProxy(
// This takes in the same parameters as `matchPath` or `` from `react-router`
// [See `react-router`'s docs for more info.](https://reacttraining.com/react-router/web/api/matchPath)
matchParams: string | string[] | MatchParams,
// ReSift will provide `params` below. Destructure it to get the desired props.
handler: (params: HttpProxyParams) => any
): HttpProxy;
HttpProxyParams
The params to the handler of an HTTP proxy.
Name | Description | Type |
---|---|---|
match | The match object from matchPath from react-router .See react-router 's docs for more info. | Match |
http | The http function that createHttpService creates. This is the same http you destructureto use the HTTP service. | (requestParams: HttpParams) => Promise |
requestParams | The parameters passed into the http call from the original request. | HttpParams |
headers | Any headers that were passed through from getHeaders in createHttpService | any |
prefix | The prefix passed into createHttpService . | string |
onCancel | The cancellation mechanism from the HTTP service. | (subscriber: () => void) => void |
getCanceled | The cancellation mechanism from the HTTP service. | () => boolean |