http   72667

« earlier    

javascript - Fetch: how to deal with a json payload in an error response? - Code Review Stack Exchange
Trying to get working with an API that almost always returns a json payload, even when the response is an error:

"message": "User not logged in",
"code": 401


Consider using Promise.reject instead of throw. It's a standard API for promises and clearly communicates your intent. Unwinding the stack trace isn't fun.

function checkStatus(response) {
if (response.ok) {
return Promise.resolve(response)

return response.json().then(json => {
const error = new Error(json.message || response.statusText)
return Promise.reject(Object.assign(error, { response }))

html5  javascript  http  request  error  stackoverflow 
yesterday by ndf
Content Security Policy  |  Web Fundamentals  |  Google Developers
CSP doesn't want you to use in-line scripts and other resources, but if there are performance or other reasons, then you can include a nonce in the inline script and in the HTTP CSP headers that much match.
:velo:toimplement  csp  http  web  security  nonce 
yesterday by reedhedges
HTTPie – command line HTTP client
HTTPie is a command line HTTP client that will make you smile.
api  cli  tools  http  programming 
yesterday by brunosabenca
Load Testing tool, developer centric open source for integrated performance testing
k6 is a developer centric open source load testing tool for testing the performance of your backend infrastructure. It’s built with Go and JavaScript to integrate well into your development workflow, so you can stay on top of performance without fuzz.
go  golang  programming  performance  load  testing  tools  http  web 
2 days ago by sschank
HTTP Prompt - An interactive command-line HTTP client
HTTP Prompt is an interactive command-line HTTP client featuring autocomplete and syntax highlighting.
http  programming  python  cli 
2 days ago by sschank
A simple tool to deploy static websites to Amazon S3 with Gzip and custom headers support (e.g. "Cache-Control")
aws  s3  http  tools 
2 days ago by justinludwig

« earlier    

related tags

:velo:toimplement  agent  aleph  apache  api  apis  app  architecture  article  async-http  async  audit  autoit  aws  axios  benchmark  berners-leetim  best-practices  bestpractices  blog  bogofile  browser  bug  c#  c  cache  caching  cancel  career  cdn  checklist  cli  client  cljs  clojure-libraries  clojure  code  commandline  connection  context  control  core  cors  csp  css  dc:creator=winerdave  dctagged  deep  development  directory  distributed  dive  dns  docker  dotnet  download  edge  emacs  encryption  endpoint  error  etag  example  express  fast  fb  fetch  filesystem  firefox  flickr  floss  flv  form  free  functional  generator  go  golang  google  gui  headers  horizontal  howto  hsts  html  html5  http2  httpclient  https  hugo  important  inspiration  interface  ip  java  javascript  js  json  keepalive  lib  library  linux  load  loadbalancing  logging  lua  lynx  mac  mailgun  manager  manifold  mbufs  meta  microsoft  minimalism  mock  module  netty  network  networking  nfs  nginx  node.js  node  nodejs  nonce  not-free  onlinetools  open_source  openness  opensource  ops  osx  overview  pages  pentest  performance  platforms  post  presentation  pressie  privacy  productivity  programming  proxy  python  query  rails  react  record  reference  regexp  request  response  rest  roundrobin  routeur  rspec  ruby  rust  rxjs  s3  scala  scaling  scraping  security  server  serverless  service-worker  shell  simplicity  snippets  socket  socks  software  softwaretesting  sonoff  spec  ssh  ssl  stackoverflow  standard  standards  state  static  string  sttp  styleguide  support  tasmota  tcp  terminal  test  testing  tls  tool  toolkit  tools  tty  tutorial  udp  unit-testing  unittest  unittesting  url  user  utility  vcr  vertical  video  visualstudio  vulcand  w3c  web  webdesign  webdev  webserver  webservices  website  wiremock  work  workflow  ztellman 

Copy this bookmark: