sindresorhus/ky ? reverse-engineered prompt
Reverse engineered prompt
Build me a tiny, elegant HTTP client for modern JavaScript that wraps the native Fetch API and makes it much easier to use.
I want it to feel simple, with handy shortcuts like get, post, put, patch, head, delete, and query, plus a main function that returns a response with easy methods like json, text, formData, arrayBuffer, blob, and bytes. It should treat non 2xx responses as errors, support retries and timeouts, make sending JSON easy, let me set a base URL and search params, and allow custom defaults through reusable instances. Add hooks so I can intercept requests and responses, and support response validation with a schema validator like Zod. Please make the TypeScript types really nice, especially for json responses and error handling.
It should work in browsers, Node.js, Bun, and Deno, stay dependency free, and include tests so the main behaviors are covered. If you need current runtime or Fetch API details, look up the latest docs online.
Are you gonna build this?
make sure you review the code using coderabbit