本文整理匯總了TypeScript中angular2/http.Headers.delete方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Headers.delete方法的具體用法?TypeScript Headers.delete怎麽用?TypeScript Headers.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular2/http.Headers
的用法示例。
在下文中一共展示了Headers.delete方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: saveComment
saveComment(id, comment,value){
var headers = new Headers();
if (this._authenticationService.isLoggedIn()) {
headers = this.httpClient.createHeader(headers);
headers.append('Content-Type', 'application/json');
}else{
headers.delete('Authorization');
headers.delete('Content-Type');
headers.append('Authorization',"");
}
var _resultUrl = '/story/'+id+'/addRating';
return this.http.post(_resultUrl, JSON.stringify({ "value": value ,"comment": comment}),{headers})
.map(this.extractData)
.do(data => console.log(data))
.catch(this.handleError);
}
示例2: deleteRating
deleteRating(id){
var headers = new Headers();
if (this._authenticationService.isLoggedIn()) {
headers = this.httpClient.createHeader(headers);
headers.append('Content-Type', 'application/json');
}else{
headers.delete('Authorization');
headers.delete('Content-Type');
headers.append('Authorization',"");
}
var _resultUrl = '/story/'+id+'/deleteRating';
return this.http.delete(_resultUrl, {headers})
.map(this.extractData)
.do(data => console.log(data))
.catch(this.handleError);
}
示例3: createNewStory
createNewStory(name,author_name,co_author_name,is_published){
var headers = new Headers();
if (this._authenticationService.isLoggedIn()) {
headers = this.httpClient.createHeader(headers);
headers.append('Content-Type', 'application/json');
}else{
headers.delete('Authorization');
headers.delete('Content-Type');
headers.append('Authorization',"");
}
var _resultUrl = '/story/';
return this.http.post(_resultUrl, JSON.stringify({ "name": name ,"authorName": author_name ,"coAuthorName": "","published":false}),{headers})
.map(this.extractData)
.do(data => console.log(data))
.catch(this.handleError);
}
示例4: updateStoryValues
updateStoryValues(key, value ,story_id){
var headers = new Headers();
if (this._authenticationService.isLoggedIn()) {
headers = this.httpClient.createHeader(headers);
headers.append('Content-Type', 'application/json');
}else{
headers.delete('Authorization');
headers.delete('Content-Type');
headers.append('Authorization',"");
}
var _resultUrl = '/story/'+story_id;
return this.http.put(_resultUrl, JSON.stringify(new function(){ this[key] = value; }),{headers})
.map(this.extractData)
//.do(data => console.log(data))
.catch(this.handleError);
}
示例5: setProfileImage
setProfileImage(formData){
var headers = new Headers();
if (this._authenticationService.isLoggedIn()) {
headers = this.httpClient.createHeader(headers);
headers.append('Content-Type', 'multipart/form-data; boundary="myBoundary"');
}else{
headers.delete('Authorization');
headers.delete('Content-Type');
headers.append('Authorization',"");
}
var _resultUrl = '/attachmentUI/addUserImage';
console.log(_resultUrl);
return this.http.post(_resultUrl, formData ,{headers})
.map(this.extractData)
.do(data => console.log(data))
.catch(this.handleError);
}
示例6: searchUser
searchUser (term): Observable<Search[]> {
var headers = new Headers();
if (this._authenticationService.isLoggedIn()) {
headers = this.httpClient.createHeader(headers);
}else{
headers.delete('Authorization');
headers.append('Authorization',"");
}
var _resultUrl = '/user/findByName/'; // URL to JSON file
return this.http.get(_resultUrl+term,{headers})
.map(this.extractData)
// .do(data => console.log(data))
.catch(this.handleError);
}
示例7: getLoggedInUser
getLoggedInUser(){
var headers = new Headers();
if (this._authenticationService.isLoggedIn()) {
headers = this.httpClient.createHeader(headers);
}else{
headers.delete('Authorization');
headers.append('Authorization',"");
}
var _resultUrl = '/user/';
return this.http.get(_resultUrl+"me",{headers})
.map(this.extractData)
// .do(data => console.log(data))
.catch(this.handleError);
}
示例8: saveData
saveData(images,texts,links,actualPage){
var headers = new Headers();
if (this._authenticationService.isLoggedIn()) {
headers = this.httpClient.createHeader(headers);
headers.append('Content-Type', 'application/json');
}else{
headers.delete('Authorization');
headers.delete('Content-Type');
headers.append('Authorization',"");
}
if(texts[0]== undefined){
texts.splice(0, 0, {content:""});
}
if(texts[1] == undefined){
texts.splice(1, 0, {content:""});
}
var id = actualPage['id']
var object = {};
object['images'] = images;
object['texts'] = texts;
object['links'] = links;
var serializedContent = btoa(JSON.stringify(object));
//here update links!!
var _resultUrl = '/page/'+id;
return this.http.put(_resultUrl, JSON.stringify({'serializedContent' : serializedContent ,'title': texts[0]['content'], 'description': texts[1]['content']}),{headers})
.map(this.extractData)
.do(data => console.log(data))
.catch(this.handleError);
}
示例9: addNewNode
addNewNode(storyID,selectedID,level,position){
var headers = new Headers();
if (this._authenticationService.isLoggedIn()) {
headers = this.httpClient.createHeader(headers);
headers.append('Content-Type', 'application/json');
} else {
headers.delete('Authorization');
headers.append('Authorization', "");
}
var _resultUrl = '/story/'+storyID+'/addPage/'+selectedID;
return this.http.post(_resultUrl, JSON.stringify({ "title": "defaultTitle" ,"description": "defaultDescription" ,"level": level,"position":position,"serializedContent": ""}),{ headers })
.map(this.extractData)
// .do(data => console.log(data))
.catch(this.handleError);
}
示例10: getChildren
getChildren(id){
var headers = new Headers();
if (this._authenticationService.isLoggedIn()) {
headers = this.httpClient.createHeader(headers);
headers.append('Content-Type', 'application/json');
} else {
headers.delete('Authorization');
headers.append('Authorization', "");
}
var _resultUrl = '/page/'+id+"/getAllOutgoing/";
return this.http.get(_resultUrl, { headers })
.map(this.extractData)
// .do(data => console.log(data))
.catch(this.handleError);
}