Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

How do I access request body in RequestInfo? #188

@hjchin

Description

@hjchin

Hi,

I'm trying to retrieve the request body from RequestInfo and put some logic in the interception to mimic the backend logic.

When I dump the RequestInfo from chrome dev tool, I can see it is in RequestInfo.req.body. Req is a type of HttpRequest. However, the interfaces.ts where RequestInfo interface is defined, states req is a type of RequestCore. RequestCore has total different definition than HttpRequest.

How do I retrieve request body in RequestInfo? Thanks.

export interface RequestCore {
  url: string; // request URL
  urlWithParams?: string; // request URL with query parameters added by `HttpParams`
}

/**
* Interface for object w/ info about the current request url
* extracted from an Http Request.
* Also holds utility methods and configuration data from this service
*/
export interface RequestInfo {
  req: RequestCore; // concrete type depends upon the Http library
  apiBase: string;
  collectionName: string;
  collection: any;
  headers: HeadersCore;
  method: string;
  id: any;
  query: Map<string, string[]>;
  resourceUrl: string;
  url: string; // request URL
  utils: RequestInfoUtilities;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions