Created
April 17, 2020 21:15
-
-
Save NyaGarcia/fa3d9ff16d12bbd8065c5b55ae74cf6e to your computer and use it in GitHub Desktop.
OBservable created with ajax(), with custom headers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // What if we need custom headers? No problem! | |
| const ghibliFilmWithHeaders$ = ajax({ | |
| url: 'https://ghibliapi.herokuapp.com/films', | |
| method: 'GET', | |
| headers: { | |
| 'Content-Type': 'json' | |
| }, | |
| body: { | |
| message: "Custom message 'cause we're so cool" | |
| } | |
| }); | |
| ghibliFilmWithHeaders$.subscribe(console.log); | |
| // Output: AjaxResponse {xhr: {}, request: {}...} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment