Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const headers: Headers = new Headers();
- headers.append('Content-Type', 'application/json');
- headers.append('Authorization', 'Bearer: 123213');
- this.http.post('https://127.0.0.1:502', JSON.stringify(token), {headers: headers}).subscribe();
- import {Http, Headers, RequestOptions} from '@angular/http';
- export class AppComponent {
- constructor(private http: Http) {
- let headers = new Headers();
- headers.append('Content-Type', 'application/json');
- headers.append('authentication', `hello`);
- let options = new RequestOptions({headers: headers});
- this.http.post(
- "http://localhost:3000/contacts",
- JSON.stringify({id: 4, name: 'some'}),
- options
- ).subscribe();
- import {Http, Headers, RequestOptions} from '@angular/http';
- constructor(private http: Http) {
- this.headers = new Headers();
- this.headers.append('content-type', 'application/json');
- }
- return this.http.post(url, jsonData, this.headers).map((resp: Response) => resp.json());
- login(credintials: Authenticate): Observable<any> {
- const body = {
- username: credintials.username,
- password: credintials.password,
- grant_type: 'password',
- client_id: credintials.client_id
- };
- const headers = new HttpHeaders()
- .set('Content-Type', 'application/x-www-form-urlencoded')
- .set('Authorization', 'Basic loremlorem');
- return this.http.post(`${baseUrl}/uaa/oauth/token`,
- body,
- {
- headers: headers
- }
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement