Mentorship-backend: Fix wrong HTTP status code for GET /users/<id> API

Created on 28 Dec 2019  路  25Comments  路  Source: anitab-org/mentorship-backend

Description

As a frontend developer,
I need to get correct status code,
so that I can code the frontend accordingly.

The GET /users/<user_id> API has wrong HTTP Status code being returned when the request is successful. The correct code should be 200 instead of 201, since no new resource is created.

Acceptance Criteria

Update [Required]

  • [ ] Fix wrong HTTP status code
  • [ ] Update tests that may break with this change

Definition of Done

  • [ ] All of the required items are completed.
  • [x] Approval by 1 mentor.

Estimation

1 hours

Coding First Timers Only Bug

Most helpful comment

@Shivansh2407
If (no previous responses):
@Shivansh2407 feel free to work on this
return issue assigned

All 25 comments

@isabelcosta I am a first-timer. Can I take up this issue?

Hello!
This is my first time contributing to an open source project. Can I work on this issue?

i think you both were assigned issues already right? @jotharman @StergiosSozos :) Let me know if this is not the case please

yes, I have been assigned issue #475 and I have made required changes for that and I am looking for another one :)

@isabelcosta if this issue is not assigned to anyone please assign this to me

@bera5186 you were assigned an issue already (one you asked for), so I won't assign you this one.

@isabelcosta
Is this issue still open?
I am a first timer and would like to work on this issue

@isabelcosta I wish to work on this issue.

@vibhuti019 before assigning to you I would like to ask @yashikabaan
@yashikabaan sorry for the delay in my response, are you still interested? I can assign it to you still :)

@isabelcosta
if( This Issue == Fixed):
Please Close the Issue
else:
I would like to fix this

@Shivansh2407
If (no previous responses):
@Shivansh2407 feel free to work on this
return issue assigned

Unassigning @Shivansh2407 due to inactivity.

Can I try working on this @isabelcosta @vj-codes ?

Yes @yash2189, go ahead 馃憤

Hello I created a new user and tested the GET /users/<user_id>API It is showing 200
(https://github.com/yash2189/mentorship-backend/blob/develop/snap_1.PNG)

@Shivansh2407 can you please have a look at this?

Hello I created a new user and tested the GET /users/<user_id>API It is showing 200
(https://github.com/yash2189/mentorship-backend/blob/develop/snap_1.PNG)

Unassigning from this please make it available for others.

@vj-codes I'd like to take this issue up. Can I be assigned to this issue ?

@justdvnsh are you contributing for the first time to this repo? If yes ,then only I can assign you
Also chose one between this or #395

@vj-codes Yeah. I contribute regularly to mentorship-android however, this is my first time in this repo.
And firstly I'd like to take up this issue then #395

Assigning you @justdvnsh
Happy coding!

@vj-codes Thanks !

Hi. @vj-codes @rpattath . I think this is not an issue. i do not see anywhere where status code of 201 is being returned. Status code of HTTPStatus.OK is being returned which is status code 200. Even in the tests the checks are fine.

Screenshot from 2020-10-17 04-54-14

Screenshot from 2020-10-17 04-56-59

@justdvnsh , @vj-codes and @rpattath . I think this issue should've been closed when I opened the issue #623 which got fixed by PR #637. I must've overlooked this issue since at the time issue #623 was opened, MS was refactoring all hard-coded HTTP error code to HTTPStatus, hence, this issue was no longer valid (as it is using hard-coded error code). I'll close this issue now. Thank you @justdvnsh for pointing this out.

@mtreacy002 Yeah. That's what I was saying. Anyway, thanks !

Was this page helpful?
0 / 5 - 0 ratings