• paequ2@lemmy.today
    link
    fedilink
    English
    arrow-up
    0
    ·
    15 days ago

    I’ve seen the status code in a JSON response before: https://cloud.google.com/storage/docs/json_api/v1/status-codes#401-unauthorized

    One reason I can think of for including it is that it may make it easier for the consumer to check the status code if it’s in the JSON. Depending on how many layers of abstraction you have, your app may not have access to the raw HTTP response.

    Although, yeah you lose the single source of truth though.

    • zalgotext@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      15 days ago

      Depending on how many layers of abstraction you have, your app may not have access to the raw HTTP response.

      That sounds like either over-abstraction or bad abstraction then