coffee-core
Version:
Coffee IT API core library
37 lines (29 loc) • 1.2 kB
text/typescript
import { HttpService } from '@nestjs/axios';
import { Observable, of } from 'rxjs';
import * as axios from 'axios';
export class HttpServiceMock extends HttpService {
public post<T = any>(url: string, data?: any, config?: axios.AxiosRequestConfig): Observable<axios.AxiosResponse<T>> {
return this.createDefaultResponse();
}
public put<T = any>(url: string, data?: any, config?: axios.AxiosRequestConfig): Observable<axios.AxiosResponse<T>> {
return this.createDefaultResponse();
}
public patch<T = any>(url: string, data?: any, config?: axios.AxiosRequestConfig): Observable<axios.AxiosResponse<T>> {
return this.createDefaultResponse();
}
public get<T = any>(url: string, config?: axios.AxiosRequestConfig): Observable<axios.AxiosResponse<T>> {
return this.createDefaultResponse();
}
public delete<T = any>(url: string, config?: axios.AxiosRequestConfig): Observable<axios.AxiosResponse<T>> {
return this.createDefaultResponse();
}
private createDefaultResponse<T = any>(): Observable<axios.AxiosResponse<T>> {
return of({
data: null,
status: 200,
statusText: 'OK',
headers: {},
config: {} as any,
});
}
}