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

Old deprecated ngx-resource - how to define responseType. #181

Open
Puza2010 opened this issue Feb 3, 2021 · 3 comments
Open

Old deprecated ngx-resource - how to define responseType. #181

Puza2010 opened this issue Feb 3, 2021 · 3 comments

Comments

@Puza2010
Copy link

Puza2010 commented Feb 3, 2021

Hi,

I know that i need to upgrade ngx-resource to the core version. But before i do, can you please tell me how to set responseType to 'blob' in ngx-resource (deprecated version)?

I need something like this using ngx-resource(deprecated version) that I wrote in angular http:

`this.http.get('url', {
          params: myParams,
          headers: new HttpHeaders({
              'Accept': 'text/csv',
              'Content-Type': 'text/csv'
          }),
          responseType: 'blob'
 }).subscribe(data => this.downloadFile(data)`

Thank you in advance!

@troyanskiy
Copy link
Owner

Hi!
In latest version try that

  @ResourceAction({
    method: ResourceRequestMethod.Get,
    pathPrefix: '/files/file/{!id}',
    responseBodyType: ResourceResponseBodyType.Blob
  })
  getFile: IResourceMethodObservable<{id: string}, Blob>;

For the deprecated version I don't really remember, but you can try to dig in the sources.

@Puza2010
Copy link
Author

Puza2010 commented Feb 3, 2021

Hi, thank you for answering!

I did find responseBodyType in core version.
But I couldn't find anything like that in deprecated version in the sources :(

@Puza2010
Copy link
Author

Puza2010 commented Feb 5, 2021

@troyanskiy any chance you could look it up? I can't find this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants