lukePeavey / quotable

Random Quotes API
MIT License
1.8k stars 212 forks source link

Use content-type header for response #185

Open neksodebe opened 1 year ago

neksodebe commented 1 year ago

I'm trying to make a custom quote message in my .bashrc file, but each response is JSON. I tried setting the Content-Type header to text/html, but no luck.

My feature request

Change the response based on Content-Type.

Example

The example route is /quotes/random

If Content-type is text/html, instead of returning

[{"_id":"_dfC0aL_AGD4","content":"Great ideas often receive violent opposition from mediocre minds.","author":"Albert Einstein","tags":["Famous Quotes","Technology"],"authorSlug":"albert-einstein","length":65,"dateAdded":"2019-08-03","dateModified":"2023-04-14"}]

return

"Great ideas often receive violent opposition from mediocre minds." - Albert Einstein
neksodebe commented 1 year ago

Either Content-Type or Accept

a2937 commented 10 months ago

That output makes sense for it to be a plain text content type rather than HTML.