Add manual test for PIS endpoint
This commit is contained in:
@@ -20,11 +20,24 @@ export class BaseClient {
|
||||
: `${root}/api/v3`;
|
||||
}
|
||||
|
||||
public async ping(): Promise<boolean> {
|
||||
try {
|
||||
await fetch(this.baseUrl, {
|
||||
method: 'HEAD',
|
||||
signal: AbortSignal.timeout(3000)
|
||||
});
|
||||
return true
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the Envelope logic
|
||||
*/
|
||||
public async request<T>(path: string, options: RequestInit = {}): Promise<ApiResult<T>> {
|
||||
const url = `${this.baseUrl}${path}`;
|
||||
console.debug(`[API DEBUG] Calling: ${url}`);
|
||||
|
||||
const headers = new Headers(options.headers);
|
||||
headers.set('Content-Type', 'application/json');
|
||||
|
||||
@@ -5,7 +5,7 @@ export class PisModule {
|
||||
constructor(private client: BaseClient) {}
|
||||
|
||||
async getByStartEndCrs(startCrs: string, endCrs: string): Promise<ApiResult<ApiPisObject.PisObjects>> {
|
||||
const path = `/pis/route/${encodeURIComponent(startCrs.toUpperCase())}/${encodeURIComponent(endCrs.toUpperCase())}`;
|
||||
const path = `/pis/route/${encodeURIComponent(startCrs.toLowerCase())}/${encodeURIComponent(endCrs.toLowerCase())}`;
|
||||
|
||||
return this.client.request<ApiPisObject.PisObjects>(path, {
|
||||
method: 'GET',
|
||||
|
||||
Reference in New Issue
Block a user