Skip to content

Conversation

Aschen
Copy link
Contributor

@Aschen Aschen commented Mar 30, 2020

What does this PR do?

When we have multiple choose for a route, we choose the shortest or the GET route.
With document:create we have the choice between those 2 routes:

{ verb: 'GET', url: '/:index/:collection/' },
{ verb: 'POST', url: '/:index/:collection/_search' }

The problem is that after even if we want to change the verb by using options.verb, the URL is not the good one and GET /:index/:collection correspond to the collection:create method.

So this PR is just a dirty fix to always use the POST route with document:search.

When we are going to fully support the GET verb with query for document:search, maybe we can get ride of this.

See this failing job on Kuzzle: https://travis-ci.org/github/kuzzleio/kuzzle/jobs/667658863

routes[controller][action] = getCorrectRoute(http);
}
else if (http && http.length > 1) {
// We need this ugly fix because the document:search route can also
Copy link
Member

Choose a reason for hiding this comment

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

Is it missing one word to fully understand those 2 first comment ?

@codecov
Copy link

codecov bot commented Mar 30, 2020

Codecov Report

Merging #498 into 7-dev will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##            7-dev     #498   +/-   ##
=======================================
  Coverage   95.79%   95.79%           
=======================================
  Files          32       32           
  Lines        1308     1309    +1     
=======================================
+ Hits         1253     1254    +1     
  Misses         55       55           
Impacted Files Coverage Δ
src/controllers/document.js 95.08% <100.00%> (-0.16%) ⬇️
src/protocols/http.js 91.08% <100.00%> (+0.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 696d418...b325e74. Read the comment docs.

@Aschen Aschen changed the base branch from master to 7-dev March 30, 2020 12:41
@Aschen Aschen merged commit b59bd78 into 7-dev Mar 31, 2020
@Aschen Aschen deleted the hotfix-document-search-http branch March 31, 2020 00:54
@Aschen Aschen mentioned this pull request Mar 31, 2020
Aschen added a commit that referenced this pull request Mar 31, 2020
# [7.1.2](https://github.com/kuzzleio/sdk-javascript/releases/tag/7.1.2) (2020-03-31)


#### Bug fixes

- [ [#498](#498) ] Hotfix document search http   ([Aschen](https://github.com/Aschen))

#### Enhancements

- [ [#496](#496) ] Exposes SearchResult classes   ([Aschen](https://github.com/Aschen))
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants