Permalink
Browse files

fix(Rest): uppercase default methods

  • Loading branch information...
doktordirk committed Apr 14, 2016
1 parent a0328aa commit a008536f60b5a53d57832561c5525e28c3bec30a
Showing with 18 additions and 5 deletions.
  1. +13 −0 README.md
  2. +5 −5 src/rest.js
@@ -72,3 +72,16 @@ export class MyClass {
}
}
```

## Quick api overview

````js
endpoint
.find(resource, criteria, options) // GET
.post(resource, body, options) { // POST
.update(resource, criteria, body, options) // PUT
.patch(resource, criteria, body, options) // PATCH
.destroy(resource, criteria, options) // DELETE
.create(resource, body, options) // POST
.request(method, path, body, options) // method
```
@@ -66,7 +66,7 @@ export class Rest {
requestPath += typeof criteria !== 'object' ? `/${criteria}` : '?' + qs.stringify(criteria);
}

return this.request('get', requestPath, undefined, options);
return this.request('GET', requestPath, undefined, options);
}

/**
@@ -79,7 +79,7 @@ export class Rest {
* @return {Promise}
*/
post(resource, body, options) {
return this.request('post', resource, body, options);
return this.request('POST', resource, body, options);
}

/**
@@ -99,7 +99,7 @@ export class Rest {
requestPath += typeof criteria !== 'object' ? `/${criteria}` : '?' + qs.stringify(criteria);
}

return this.request('put', requestPath, body, options);
return this.request('PUT', requestPath, body, options);
}

/**
@@ -119,7 +119,7 @@ export class Rest {
requestPath += typeof criteria !== 'object' ? `/${criteria}` : '?' + qs.stringify(criteria);
}

return this.request('patch', requestPath, body, options);
return this.request('PATCH', requestPath, body, options);
}

/**
@@ -138,7 +138,7 @@ export class Rest {
requestPath += typeof criteria !== 'object' ? `/${criteria}` : '?' + qs.stringify(criteria);
}

return this.request('delete', requestPath, undefined, options);
return this.request('DELETE', requestPath, undefined, options);
}

/**

0 comments on commit a008536

Please sign in to comment.