Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend hooks config endpoint #256

Merged
merged 9 commits into from
May 29, 2017
Merged

Conversation

eduardoboucas
Copy link
Contributor

@eduardoboucas eduardoboucas commented May 4, 2017

This PR extends the hooks config endpoint (/api/hooks/:hookName/config) to accept POST, PUT and DELETE requests to create, update and delete hooks, respectively. Acceptance tests are included.

Close #254

@jimlambie I branched off feat/media-endpoint, and so I made the PR with that branch as base. Let me know if that's an issue.

Thanks!


return help.sendBackJSON(404, res, next)(null, {})
return help.sendBackJSON(400, res, next)(null, {'error': 'Invalid method'})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could return a 405 here, Method Not Allowed


return help.sendBackJSON(200, res, next)(null, data)
return help.sendBackJSON(400, res, next)(null, {'error': 'Invalid method'})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could return a 405 here, Method Not Allowed

@@ -3223,7 +3223,7 @@ describe('Application', function () {

it('should return 400 if request method is not supported', function (done) {
request(connectionString)
.put('/api/hooks/xx/config')
.put('/api/hooks')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

405? :)

Copy link
Contributor

@jimlambie jimlambie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, apart from the HTTP response codes! :)

🥇

@eduardoboucas
Copy link
Contributor Author

Totally! There were a few instances of 400 being used to respond to "Invalid method", so I have replaced those with 405 and updated the tests.

@jimlambie jimlambie merged commit 97d43cf into feat/media-endpoint May 29, 2017
@jimlambie jimlambie deleted the feature/hooks-endpoint branch May 29, 2017 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants