How to use the @angular/http.RequestOptions function in @angular/http

To help you get started, we’ve selected a few @angular/http examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Infosys / openIDP / ui / src / main / angular4src / src / app / idprestapi.service.ts View on Github external
getTimeZone(): Promise {
    const url = this.idpdataService.devServerURL + "/releaseService/serverTimeZone";
    const headers = new Headers();
    let cookie;
    if (this._cookieService.get("access_token")) {
        cookie = this._cookieService.get("access_token");
    }
    headers.append("Authorization", "Bearer " + cookie);
    const options = new RequestOptions({ headers: headers });
    return this.http
        .get(url, options)
        .toPromise()
        .then(response => response)
        .catch(error => console.log(error));

  }
github Infosys / openIDP / ui / src / main / angular4src / src / app / idprestapi.service.ts View on Github external
getArtifactLatestDetails(data): Promise {
    const url = this.idpdataService.devServerURL + "/releaseService/latest/artifact/details/" + data;
    const headers = new Headers();
    let cookie;
    if (this._cookieService.get("access_token")) {
        cookie = this._cookieService.get("access_token");
    }
    headers.append("Authorization", "Bearer " + cookie);
    const options = new RequestOptions({ headers: headers });
    console.log(url);
    return this.http
        .get(url, options)
        .toPromise()
        .then(response => response)
        .catch(error => console.log(error));

  }
github Educama / Showcase / frontend / src / app / shared / http / services / rest-client.service.ts View on Github external
public post(url: string, body?: string): Observable {
        this._headers.set("Content-Type", "application/json");
        const options = new RequestOptions({headers: this._headers});
        if (body === null) {
          body = "";
        }
        return this._http
            .post(this._baseUrl + url, body, options)
            .map(response => this.mapResponse(response))
            .catch(error => this.handleError(error));
    }
github wikift / wikift / wikift-web / src / app / shared / utils / http.util.ts View on Github external
public static getDefaultRequestOptions() {
        const headers = new Headers({
            'Content-Type': 'application/json',
            'Accept': 'application/json'
        });
        const options = new RequestOptions({ headers: headers });
        return options;
    }
github humpback / humpback-web / src / client / app / services / custom-http.service.ts View on Github external
_buildOptions(options: any, type: any) {
    let headers = new Headers();
    headers.append('Accept', 'application/json');
    if (type !== 'GET' && type !== 'DELETE') {
      headers.append('Content-Type', 'application/json');
    }
    if (options && options.headers && typeof options.headers === 'object') {
      Object.keys(options.headers).forEach(k => {
        headers.set(k, options.headers[k]);
      });
    }
    let reqOptions = new RequestOptions({
      headers: headers
    });
    return reqOptions;
  }
github vmware / flowgate / ui / src / app / pages / setting / setting.service.ts View on Github external
mergeserverMapping(){
      let header = new Headers({ 'Content-Type': 'application/json' });
      header.append("Authorization",'Bearer ' + this.auth.getToken());
      this.options = new RequestOptions({ headers: header });
        return this.http.post(""+this.API_URL+"/v1/jobs/mergeservermapping",null,this.options).map((res)=>res)
    }
github cloudfoundry / stratos / src / app / store / actions / space.action.ts View on Github external
constructor(public guid: string, public cnis: string) {
    super();
    this.options = new RequestOptions();
    this.options.url = `space/${guid}`;
    this.options.method = 'get';
  }
  actions = [
github liimaorg / liima / AMW_angular / io / src / app / deployment / environment.service.ts View on Github external
private getEnvironments(includingGroups: boolean): Observable {
    const params: URLSearchParams = new URLSearchParams();
    if (includingGroups) {
      params.set('includingGroups', 'true');
    }
    const options = new RequestOptions({
      search: params,
      headers: this.getHeaders()
    });
    return this.http
      .get(`${this.getBaseUrl()}/environments`, options)
      .map((response: Response) => response.json())
      .catch(this.handleError);
  }
github miroslaw-bogacz / time-tracker / src / app / shared / jira-api / services / jira.service.ts View on Github external
public get requestOptions(): RequestOptionsArgs {
    const options: RequestOptions = new RequestOptions();
    const headers: Headers = new Headers();

    headers.set('Authorization', `Basic ${this.jiraRequestOptions.token}`);
    options.headers = headers;

    return options;
  }
github rucken / core / demo / src / app / demo / shared / helpers / http.helper.ts View on Github external
delete(url: string): Observable {
    let headers = new Headers({ 'Content-Type': 'application/json' });

    let options = new RequestOptions({ headers: headers, withCredentials: this.withCredentials });
    if (environment.production) {
      return this.http.get(url);
    }
    return this.authHttp.delete(url, options);
  }
}