Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Mvrlex opened this issue May 7, 2020 · 4 comments
Open

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

Mvrlex opened this issue May 7, 2020 · 4 comments
Assignees
Labels
enhancement Request for a change or improvement of existing functionality feature request Proposal for a new feature
Milestone

Comments

@Mvrlex
Copy link

Mvrlex commented May 7, 2020

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!

@Mvrlex Mvrlex changed the title Include "observe" and "responseType" on an as per request basis Include "observe" and "responseType" on a per request basis May 7, 2020
@vmasek
Copy link
Member

vmasek commented May 7, 2020

@Mvrlex Hello, thank you and thanks for the report 👍

It shouldn't be a problem to add this functionality and I will have a look into it.
It will require an overload to the methods and some changes to the method logic, so it will be out after some testing is done. I'll try to announce an ETA as soon as I'll have some estimate.

@vmasek vmasek self-assigned this May 7, 2020
@Topfgriff
Copy link

@vmasek Hello, are there any updates on this?

@vmasek
Copy link
Member

vmasek commented Nov 13, 2020

Hello, this was held up as it requires more test cases. But I could be able to prioritize it at least for experimental use.

@vmasek vmasek added this to the 5.0 milestone Dec 9, 2020
@vmasek vmasek added enhancement Request for a change or improvement of existing functionality feature request Proposal for a new feature labels Dec 18, 2020
vmasek added a commit that referenced this issue Dec 22, 2020
…i client interface

 This will avoid repetition and allow us to have nicer method overloading for implementation of #91
@Mvrlex
Copy link
Author

Mvrlex commented Aug 17, 2021

We are currently refactoring our project and I've just added the new api-client-generator 5.0.0-beta.5.
It works now. Nice implementation.

@vmasek vmasek moved this to Implemented / Integration testing in Main board Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for a change or improvement of existing functionality feature request Proposal for a new feature
Projects
Status: Implemented / Integration testing
Development

No branches or pull requests

3 participants