當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Headers.get方法代碼示例

本文整理匯總了TypeScript中@angular/http.Headers.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Headers.get方法的具體用法?TypeScript Headers.get怎麽用?TypeScript Headers.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/http.Headers的用法示例。


在下文中一共展示了Headers.get方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: setTimeout

            setTimeout(()=>{
                expect(auth.isOrgApiKeySet).toBeTruthy();
                let headers = new Headers();
                auth.appendHeaders(headers);
                expect(headers.get('Authorization')).not.toBeNull();

                login.activate('');
                // update both
                login.onApiKeySet(SAMPLE_API_KEY, true);
                headers = new Headers();
                auth.appendHeaders(headers);

                expect(headers.get('Authorization')).toBe(SAMPLE_AUTHORIZATION);
                expect(settings.organizationApiKey).toBe(SAMPLE_API_KEY);
            }, EVENT_WAIT_MILLIS);
開發者ID:james-hu,項目名稱:rtstatistics-web-mconsole,代碼行數:15,代碼來源:login.component.spec.ts

示例2: savePhoto

	savePhoto(projectId:number, stepId:number, photoToSave:Photo, header: Headers) {

		delete photoToSave.file; //the file won't be updated, so we need to remove it from the body of the request
	    let body = JSON.stringify(photoToSave);
		
		if (header.get('Content-Type')!='application/json')
	    	header.append('Content-Type', 'application/json');

    	return this.http.put(this.uploadPhotoUrl + projectId + "/step/" + stepId + "/update/" + photoToSave.id + "/" ,
    		body, {
				headers: header
			})
			.map((responseData) => {

				let photo = responseData.json();
				header.delete('Content-Type');
				return new Photo(
						photo.id, 
						photo.created,
						photo.file,
						photo.position,
						photo.step,
						photo.isProjectPhoto
					);
			});

	}
開發者ID:marcosbeto,項目名稱:meviro,代碼行數:27,代碼來源:photo.service.ts

示例3: saveStep

	saveStep(projectID:number, stepToSave:Step, header: Headers) {

	    let body = JSON.stringify(stepToSave);

	    if (header.get('Content-Type')!='application/json')
	    	header.append('Content-Type', 'application/json');

	    if (stepToSave.id!=null) { //update
	    	return this.http.put(this.baseUrl + "steps/update/" + stepToSave.id + "/" ,
	    		body, {
					headers: header
				})
				.map((responseData) => {
					let step = responseData.json();
					header.delete('Content-Type');
					return new Step(step.id, step.position, step.title, step.content, step.project);
				});


	    }

	    console.log()

		return this.http.post(this.listProjectsUrl + stepToSave.project + "/steps/add/", 
			body, {
				headers: header
			})
			.map((responseData) => {
				let step = responseData.json();
				header.delete('Content-Type');
				return new Step(step.id, null, step.title, step.content, step.project);
			});
	}
開發者ID:marcosbeto,項目名稱:meviro,代碼行數:33,代碼來源:step.service.ts

示例4: get

 get(): Observable<string[]> {
   let headers = new Headers();
   //headers.append('Content-Type', 'application/json');
   headers.append('Accept', 'application/json');
   console.log(headers.get('Accept')); //'image/jpeg'
   let options = new RequestOptions({ headers: headers });
   return this.http.get('http://rxnav.nlm.nih.gov/REST/Ndfrt/search?conceptName=aspirin')
     .map((res: Response) => res)
     .catch(this.handleError);
 }
開發者ID:gkoum,項目名稱:giesu,代碼行數:10,代碼來源:ndf.service.ts

示例5: header

 public header(headerName: string): string {
     return this.headers.get(headerName);
 }
開發者ID:dotCMS,項目名稱:core-web,代碼行數:3,代碼來源:response-view.ts


注:本文中的@angular/http.Headers.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。