admin-config
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -26,3 +26,6 @@ import stringUtils from "../Utils/stringUtils"; | ||
this._url = null; | ||
this._createMethod = null; // manually set the HTTP-method for create operation, defaults to post | ||
this._updateMethod = null; // manually set the HTTP-method for update operation, defaults to put | ||
this._initViews(); | ||
@@ -198,4 +201,16 @@ } | ||
} | ||
createMethod(createMethod) { | ||
if (!arguments.length) return this._createMethod; | ||
this._createMethod = createMethod; | ||
return this; | ||
} | ||
updateMethod(updateMethod) { | ||
if (!arguments.length) return this._updateMethod; | ||
this._updateMethod = updateMethod; | ||
return this; | ||
} | ||
} | ||
export default Entity; |
@@ -16,3 +16,3 @@ import Queries from './Queries' | ||
return this._restWrapper | ||
.createOne(rawEntity, view.entity.name(), this._application.getRouteFor(view.entity, view.getUrl(), view.type)); | ||
.createOne(rawEntity, view.entity.name(), this._application.getRouteFor(view.entity, view.getUrl(), view.type), view.entity.createMethod()); | ||
} | ||
@@ -35,3 +35,3 @@ | ||
return this._restWrapper | ||
.updateOne(rawEntity, view.entity.name(), this._application.getRouteFor(view.entity, view.getUrl(entityId), view.type, entityId, view.identifier())); | ||
.updateOne(rawEntity, view.entity.name(), this._application.getRouteFor(view.entity, view.getUrl(entityId), view.type, entityId, view.identifier()), view.entity.updateMethod()); | ||
} | ||
@@ -38,0 +38,0 @@ |
{ | ||
"name": "admin-config", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -64,2 +64,26 @@ var assert = require('chai').assert; | ||
}) | ||
describe('createMethod', function() { | ||
it('should return given createMethod if already set', function() { | ||
var post = new Entity('post').createMethod("put"); | ||
assert.equal('put', post.createMethod()); | ||
}); | ||
it('should return null if no createMethod has been set', function() { | ||
var post = new Entity('post'); | ||
assert.equal(null, post.createMethod()); | ||
}); | ||
}); | ||
describe('updateMethod', function() { | ||
it('should return given updateMethod if already set', function() { | ||
var post = new Entity('post').updateMethod("post"); | ||
assert.equal('post', post.updateMethod()); | ||
}); | ||
it('should return null if no updateMethod has been set', function() { | ||
var post = new Entity('post'); | ||
assert.equal(null, post.updateMethod()); | ||
}); | ||
}); | ||
}); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
118765
65
3170
1