diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts
index a11421e19..93787cf3d 100644
--- a/axios/axios-tests.ts
+++ b/axios/axios-tests.ts
@@ -1,23 +1,18 @@
///
-interface InputBody {
- random: number;
-}
+enum HttpMethod { GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH }
+enum ResponseType { arraybuffer, blob, document, json, text }
interface Repository {
id: number;
name: string;
}
-function convenientGet () {
- axios.get("https://api.github.com/repos/mzabriskie/axios")
- .then(r => console.log(r.config.data.random));
-}
+axios.get("https://api.github.com/repos/mzabriskie/axios")
+ .then(r => console.log(r.config.method));
-function get() {
- axios({
- url: "https://api.github.com/repos/mzabriskie/axios",
- method: Axios.HTTPMethod.GET,
- headers: {},
- }).then(r => console.log("ID:" + r.data.id + " Name: " + r.data.name));
-}
\ No newline at end of file
+axios({
+ url: "https://api.github.com/repos/mzabriskie/axios",
+ method: HttpMethod[HttpMethod.GET],
+ headers: {},
+}).then(r => console.log("ID:" + r.data.id + " Name: " + r.data.name));
diff --git a/axios/axios.d.ts b/axios/axios.d.ts
index 5455ba167..c2a2873ea 100644
--- a/axios/axios.d.ts
+++ b/axios/axios.d.ts
@@ -6,8 +6,6 @@
///
declare module Axios {
- export enum HTTPMethod { GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH }
- export enum ResponseType { arraybuffer, blob, document, json, text }
/**
* - request body data type
@@ -46,7 +44,7 @@ declare module Axios {
* indicates the type of data that the server will respond with
* options are 'arraybuffer', 'blob', 'document', 'json', 'text'
*/
- responseType?: Axios.ResponseType;
+ responseType?: string;
/**
* name of the cookie to use as a value for xsrf token
@@ -65,14 +63,15 @@ declare module Axios {
*/
interface AxiosXHRConfig extends AxiosXHRConfigBase {
/**
- * server URL that will be used for the request
+ * server URL that will be used for the request, options are:
+ * GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH
*/
url: string;
/**
* request method to be used when making the request
*/
- method?: Axios.HTTPMethod;
+ method?: string;
/**
* data to be sent as the request body
@@ -86,7 +85,7 @@ declare module Axios {
* - expected response type,
* - request body data type
*/
- interface AxiosXHR {
+ interface AxiosXHR {
/**
* Response that was provided by the server
*/
@@ -110,7 +109,7 @@ declare module Axios {
/**
* config that was provided to `axios` for the request
*/
- config: AxiosXHRConfig;
+ config: AxiosXHRConfig;
}
/**
@@ -119,40 +118,40 @@ declare module Axios {
*/
interface AxiosStatic {
- (config: AxiosXHRConfig): Promise>;
+ (config: AxiosXHRConfig): Promise>;
- new (config: AxiosXHRConfig): Promise>;
+ new (config: AxiosXHRConfig): Promise>;
/**
* convenience alias, method = GET
*/
- get(url: string, config?: AxiosXHRConfigBase): Promise>;
+ get(url: string, config?: AxiosXHRConfigBase): Promise>;
/**
* convenience alias, method = DELETE
*/
- delete(url: string, config?: AxiosXHRConfigBase): Promise>;
+ delete(url: string, config?: AxiosXHRConfigBase): Promise>;
/**
* convenience alias, method = HEAD
*/
- head(url: string, config?: AxiosXHRConfigBase): Promise>;
+ head(url: string, config?: AxiosXHRConfigBase): Promise>;
/**
* convenience alias, method = POST
*/
- post(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>;
+ post(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>;
/**
* convenience alias, method = PUT
*/
- put(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>;
+ put(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>;
/**
* convenience alias, method = PATCH
*/
- patch(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>;
+ patch(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>;
}
}