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

api: custom headers #48

Merged
merged 1 commit into from
Nov 15, 2019
Merged

api: custom headers #48

merged 1 commit into from
Nov 15, 2019

Conversation

sebdeleze
Copy link

  • Adds a config to specify custom headers to api calls.

Co-Authored-by: Sébastion Délèze sebastien-deleze@rero.ch

@sebdeleze sebdeleze requested review from Garfield-fr and jma November 10, 2019 15:18
searchHeaders: {
'Content-Type': 'application/rero+json'
},
detailHeaders: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a bad name. You can use similar name than the invenio-records-rest API convention, i.e. list, item.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return this.http.get<Record>(this.apiService.getEndpointByType(type, true) + '/', { params: httpParams })
let httpHeaders: HttpHeaders;
if (headers) {
httpHeaders = new HttpHeaders(headers);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be done with an inline if statement.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, and I created a method to factorize this.

@sebdeleze sebdeleze requested a review from jma November 11, 2019 15:42
* Adds a config to specify custom headers to api calls.

Co-Authored-by: Sébastion Délèze <sebastien-deleze@rero.ch>
@sebdeleze sebdeleze merged commit 2c878c4 into rero:dev Nov 15, 2019
@sebdeleze sebdeleze deleted the sed-custom-headers branch November 15, 2019 11:24
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

Successfully merging this pull request may close these issues.

3 participants