本文整理汇总了TypeScript中@angular/http.Headers类的典型用法代码示例。如果您正苦于以下问题:TypeScript Headers类的具体用法?TypeScript Headers怎么用?TypeScript Headers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Headers类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: headers
private get headers() : any {
const headers = new Headers();
headers.append('x-xsrf-token', JsonService.token);
return new RequestOptions({'headers' : headers});
}
示例2: getAuthorizationHeaders
private getAuthorizationHeaders(): Headers{
let headers = new Headers();
headers.append("Authorization", "Bearer " + Config.token);
headers.append("Content-Type", "application/json");
return headers;
}
示例3: postFile1
public postFile1(data?: any) {
let newHeader = new Headers();
newHeader.append("Authorization", "JWT " + this._authen.getAccessTokenUser().access_token);
return this._http.post(SystemConstants.BASE_URL + SystemConstants.urls.upload_image.upload_image , data, { headers: newHeader })
.map(this.extractData);
}
示例4: login
login(username: string, password: string): Promise<any> {
const headers = new Headers();
headers.append('Content-Type','text/plain');
return this.pg.postP('users/checkLogin/'+username + "/" + password, {}, headers)
}
示例5: Headers
import { Headers } from '@angular/http';
export const contentHeaders = new Headers();
contentHeaders.append('Accept', 'application/json');
contentHeaders.append('Content-Type', 'application/json');
contentHeaders.append('Access-Control-Allow-Origin', '*');
示例6: login
login(details) {
let headers = new Headers;
headers.append('Content-Type', 'application/json');
return this.http.post('http://127.0.0.1:5000/Authenticate',details)
.map(res=>res.json())
}
示例7: save
save(todo) {
var headers = new Headers();
headers.append('Content-Type', 'application/json');
return this.http.post('/api/v1/todo', JSON.stringify(todo), {headers: headers})
.map(res => res.json());
}
示例8: setAuthorizationHeader
/**
* This method appends the authorization header to the request
* @param {Headers} headers Headers object to fill with the Authorization token
* @return {Headers} Returns the headers object
*/
public setAuthorizationHeader(headers: Headers, idUser: string): Headers {
headers.append(AppConfig.AUTH_HEADER, idUser);
return headers;
}
示例9: getHeaders
private getHeaders(contentType?: string): Headers {
var headers = new Headers();
headers.append('Content-Type', 'application/json');
return headers;
}
示例10:
delete_folder(id:number){
this.headers.delete("Authorization");
this.headers.delete("Content-Type");
this.headers.append("Authorization", "JWT " + this._authen.getAccessTokenUser().access_token);
return this._http.delete(SystemConstants.BASE_URL + SystemConstants.urls.folder.get_update_delete + id, { headers: this.headers }).map(this.extractData);
}