-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3 Created Service Class for the HttpRequest.
- Loading branch information
Peter Schneider
authored and
Peter Schneider
committed
Sep 9, 2020
1 parent
d86fd01
commit acbbaca
Showing
4 changed files
with
57 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { HttpService } from './http.service'; | ||
|
||
describe('HttpService', () => { | ||
beforeEach(() => TestBed.configureTestingModule({})); | ||
|
||
it('should be created', () => { | ||
const service: HttpService = TestBed.get(HttpService); | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient, HttpHeaders } from '@angular/common/http'; | ||
|
||
|
||
const headers = new HttpHeaders() | ||
.set('Ocp-Apim-Subscription-Key', '272101d76e92479c9762f658ecff0dc3'); | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
|
||
export class HttpService { | ||
constructor(private http: HttpClient) { } | ||
url = 'https://preview-demo-mm.azure-api.net/private/api/management/apis?'; | ||
|
||
getCharacters() { | ||
return this | ||
.http | ||
.get(`${this.url}`, { headers }); | ||
} | ||
} | ||
|