Uploaded image for project: 'ListenBrainz'
  1. ListenBrainz
  2. LB-73

return meaningful errors with bad requests.

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Normal Normal
    • None
    • API
    • None

      currently, i don't think the "_validate_auth_header()" function is working as expected...

      https://github.com/metabrainz/listenbrainz-server/blob/master/webserver/views/api.py#L108

      if you omit the "Authorization" header completely, it returns HTTP status 0 with no response text.
      if you include the "Authorization" header but with no token, it also returns HTTP status 0 with no response text.

      and if you omit the "artist_name" or "track_name" parameters, you do get a meaningful error.. but it's returned as HTML. it should be JSON.

          [LB-73] return meaningful errors with bad requests.

          marc added a comment -

          Turns out my environment can't detect 401 responses so that's not a server issue.

          And the JSON response issue has been fixed in LB-191

          marc added a comment - Turns out my environment can't detect 401 responses so that's not a server issue. And the JSON response issue has been fixed in LB-191

          From my testing it looks like Authorization header checking always worked correctly. Anyway, they all return json now.

          https://github.com/metabrainz/listenbrainz-server/pull/61

          Alastair Porter added a comment - From my testing it looks like Authorization header checking always worked correctly. Anyway, they all return json now. https://github.com/metabrainz/listenbrainz-server/pull/61

          The last item depends on LB-62. Once we split the API into a separate app we can return json error messages for api queries

          Alastair Porter added a comment - The last item depends on LB-62 . Once we split the API into a separate app we can return json error messages for api queries

            Unassigned Unassigned
            marc2k3 marc
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package