chucknorris-io / chuck-api

👊 chucknorris.io is a free resource for hand curated Chuck Norris facts.
https://api.chucknorris.io
GNU General Public License v3.0
239 stars 29 forks source link

Strings are not escaped #36

Closed Ahmadre closed 3 years ago

Ahmadre commented 3 years ago

I use this api in our CI/CD Pipeline and we got JSON errors that it's invalid, because of some jokes where strings are not escaped.

Example:

Chuck Norris was asked if he would date Rosie O'\''Donnell? Chuck said "I'\''d rather shove a lit match up my pee-hole"

The error lies here: '\''Donnell? Chuck said "I'\''d

Ahmadre commented 3 years ago

solved it with jq '.value | tostring'

matchilling commented 3 years ago

Hey @Ahmadre, thanks for using the Chuck Norris api and for reporting this issue. Please note that all api endpoints can return plain text as well, just add accept: text/plain to your request and you'll get a plain text representation for the given resource. E.g.

curl --request GET \
       --url 'https://api.chucknorris.io/jokes/random' \
       --header 'accept: text/plain'

Hope this helps 🙏

Bests, Matías

Ahmadre commented 3 years ago

Thanks for your reply it worked after I found that :)

Ahmadre commented 3 years ago

Our Team and Devs loves this in our CI-Reports!

You guys rock!