Skip to content

Include "observe" and "responseType" on a per request basis #91

Open
@Mvrlex

Description

@Mvrlex

Hey,

First of all: I really like this library and I use it for all of my projects at work, so thanks for the work you put into it.

My issue is the requestHttpOptions you are able to pass when executing a request. The HttpOptions currently contain these options:

export interface HttpOptions {
  headers?: HttpHeaders;
  params?: HttpParams;
  reportProgress?: boolean;
  withCredentials?: boolean;
}

What I'm missing is the observe and responseType option that the HttpClient has:

function get<T>(url: string, options?: {
    headers?: HttpHeaders | {
        [header: string]: string | string[];
    };
    observe?: 'body';
    params?: HttpParams | {
        [param: string]: string | string[];
    };
    reportProgress?: boolean;
    responseType?: 'json';
    withCredentials?: boolean;
}): Observable<T>;

It would also be nice to set these on a per request basis like the HttpClient allows you to.

The problem is that our API has an endpoint which downloads a file, so for only that one request I would have to set the responseType to 'blob' and the observe to 'response' so I can read the ContentDisposition-header and filename.

Would it be possible to add this?
Thanks!

Metadata

Metadata

Assignees

Labels

enhancementRequest for a change or improvement of existing functionalityfeature requestProposal for a new feature

Type

No type

Projects

Status

Implemented / Integration testing

Relationships

None yet

Development

No branches or pull requests

Issue actions