当前位置: 首页>>代码示例>>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;未经允许,请勿转载。