{"repo":"posva/mande","free":true,"listed":false,"github":"https://github.com/posva/mande","clone":"git clone https://github.com/posva/mande.git","description":"800 bytes modern wrapper around fetch with smart defaults","language":"TypeScript","stars":1335,"topics":["fetch","api","browser","esm","http-client","typescript"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"mande Simple, light and extensible wrapper around fetch with smart defaults Requires fetch support. mande has better defaults to communicate with APIs using fetch , so instead of writing: You can write: Installation Usage Creating a small layer to communicate to your API: Adding Authorization tokens: You can also globally add default options to all mande instances: To delete a header, pass null to the mande instance or the request: TypeScript All methods defined on a mande instance accept a type generic to type their return: SSR (and Nuxt in Universal mode) To make Mande work on Server, make sure to provide a fetch polyfill and to use full URLs and not absolute URLs starting with / . For example, using node-fetch , you can do: Nuxt 2 Note: If you are doing SSR with authentication, Nuxt 3 hasn't been adapted yet. See #308. When using with Nuxt and SSR , you must wrap exported functions so they automatically proxy cookies and headers on the server: Make sure to add it as a buildModule as well: This prevents requests from accidentally sharing headers or bearer tokens. TypeScript Make sure to include mande/nuxt in your tsconfig.json : API Most of the code can be discovered through the autocompletion but the API documentation is available at https://mande.esm.is Cookbook Timeout You can timeout requests by using the native AbortSignal : This is supported by all modern browsers. FormData When passing Form Data, mande automatically removes the Content-Type header but you can manuall","default_branch":null,"files":null,"tree":[],"storefront":"/r/posva","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/posva/mande/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}