UNPKG

swagger-tests

Version:

A typescript framework for testing an api against a swagger 3.0 json file.

28 lines 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const application_constant_1 = require("../constants/application.constant"); const axios_1 = require("axios"); const defaultConfig = { baseURL: application_constant_1.Application.serverUrl(), maxRedirects: 0, validateStatus: (_status) => true }; class HttpService { static get(config = {}, path, params = {}, id) { return axios_1.default(Object.assign({}, defaultConfig, config, { method: 'get', url: `${path}${id}/`, params: params })); } static query(config = {}, path, params = {}) { return axios_1.default(Object.assign({}, defaultConfig, config, { method: 'get', url: path, params: params })); } static post(config = {}, path, params) { return axios_1.default(Object.assign({}, defaultConfig, config, { method: 'post', url: path, data: params })); } static put(config = {}, path, params, id) { return axios_1.default(Object.assign({}, defaultConfig, config, { method: 'put', url: `${path}${id}/`, data: params })); } static delete(config = {}, path, params = {}, id) { return axios_1.default(Object.assign({}, defaultConfig, config, { method: 'delete', url: `${path}${id}/`, params: params })); } } exports.HttpService = HttpService; //# sourceMappingURL=http.service.js.map