question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

suggestion: json response

See original GitHub issue

it’d be useful to request https://http.cat/401 with either “Accept: application/json” or /401.json to get a response similar to

{ 
 "code": 401
 "description": "Unauthorized"
}

mostly I am looking for a data source for an irc bot to respond to “!http 401”.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
donpdonpcommented, Apr 15, 2020

this snippit will pull http status codes from the wikipedia page of List of HTTP Status Codes, and builds a json file for each one. (note, required the ‘pup’ html command line parser)

curl https://en.wikipedia.org/wiki/List_of_HTTP_status_codes | pup -n 'div.mw-parser-output dl dt text{}' | sed -r 's/^([0-9]+) ([^(]+)(.*)/\1 {"code":\1, "text":\"\2\"}/;t;d' /tmp/a|while read -r code line; do echo $line > $code.json ; done

0reactions
Tijmen34commented, Mar 10, 2021

It has been a long time, but I found this issue again 😆 . I took note of @donpdonp script and created one that does not use pup and can simply be ran with bash. I can also add the actual files if that is more desirable or change bash -> sh to be in line with the other scripts. Let me know @rogeriopvl

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto-completion web service (suggest.json) - Knowledge Base
This article discusses how to call the web service and the JSON response. ... The suggest.json endpoint accepts the following parameters, passed as...
Read more >
How do I create an auto suggestion from a JSON API response?
The following should be able to handle the JSONP response based on the JSON you are giving as an example. You can see...
Read more >
JSON:API — Recommendations
This section contains recommendations for JSON:API implementations. These recommendations are intended to establish a level of consistency in areas that are ...
Read more >
How to decode the JSON response fr… - Apple Developer
I am trying to understand how to decode the JSON response returned by the suggestions/top results endpoint in MusicKit. As you can see...
Read more >
Quick Autocomplete App With JS & JSON - YouTube
In this project we will build a simple web app that searches a JSON file using the Fetch API, Async/Await, Regex and high...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found