AnswerDotAI / ghapi

A delightful and complete interface to GitHub's amazing API
https://ghapi.fast.ai/
Apache License 2.0
626 stars 65 forks source link

markdown.render doesn't send JSON back, but instead HTML. #95

Closed SuperSonicHub1 closed 12 months ago

SuperSonicHub1 commented 3 years ago
$ curl \
>   -X POST \
>   -H "Accept: application/vnd.github.v3+json" \
>   https://api.github.com/markdown \
>   -d '{"text":"text"}'
<p>text</p>

Since ghapi always expects a JSON response, this causes a json.JSONDecodeError to be raised.

My current workaround is really hackish:

try:
    rendered_readme = api.markdown.render(
        b64decode(readme["content"]).decode()
    )
except JSONDecodeError as e:
    rendered_readme = e.doc
SuperSonicHub1 commented 2 years ago

Anyone gonna handle this?