Any ideas how to get the endpoints to return pure JSON? This only happens when using fetch in the browser as far as I can tell, when using curl in the command line I get pure JSON. I’m using the lemmy-js-client and it’s throwing errors because of this as well

  • PrefixM
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Interesting! I’m using the lemmy-js-client but not seeing this.

    Mind sharing what the client is giving you back? Is it HTML or are you getting a non-stringified JSON response?

    • shootwhatsmynameOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Well now I switched from using lemmy-js-client in the browser to using it server-side, and on the server environment it returns everything as expected in JSON.

      On the client, I was being denied because of CORS, so I tried piping it through a proxy and that’s when I started getting HTML. It was returning a partially-rendered HTML page with the requested data when fetching using getSite() for example, so it errored trying to parse <!DOCTYPE… etc. as JSON

      I’ll try to get exactly what it was returning when I’m home next week, but maybe I should be using lemmy-js-client server-side anyway