Forem: Articles API: state=all by itself results in a 500 error

Created on 21 Oct 2019  路  3Comments  路  Source: forem/forem

Describe the bug

Calling curl https://dev.to/api/articles?state=all results in a 500 error.

Although, according to the documentation, that specific parameter is only to be used in conjunction with username, used by itself shouldn't result in a 500 error, instead it should return an empty result set.

To Reproduce

  1. Type curl https://dev.to/api/articles?state=all or curl http://localhost:3000/api/articles?state=all in your local development environment
  2. see error

Expected behavior

Calling curl https://dev.to/api/articles?state=all should return an empty JSON array

Additional context

The issue is likely the missing else condition here:

https://github.com/thepracticaldev/dev.to/blob/0d2506f9ef79a32f7474001337161314d1062134/app/services/article_api_index_service.rb#L77-L85

api-v0 ready for dev bug

All 3 comments

I can take a look at this. :slightly_smiling_face:

@rhymes plz review and merge

@tudorpavel just FYI, @sabunt submit a PR for this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Turnerj picture Turnerj  路  3Comments

NansD picture NansD  路  3Comments

miku86 picture miku86  路  3Comments

michael-tharrington picture michael-tharrington  路  3Comments

benhalpern picture benhalpern  路  3Comments