Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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));
}
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));
}
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));
}
public static getDefaultRequestOptions() {
const headers = new Headers({
'Content-Type': 'application/json',
'Accept': 'application/json'
});
const options = new RequestOptions({ headers: headers });
return options;
}
_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;
}
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)
}
constructor(public guid: string, public cnis: string) {
super();
this.options = new RequestOptions();
this.options.url = `space/${guid}`;
this.options.method = 'get';
}
actions = [
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);
}
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;
}
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);
}
}