Skip to content

Commit

Permalink
Ignore cache when fetching remote resources
Browse files Browse the repository at this point in the history
Fix #237
  • Loading branch information
kyoshino committed Oct 31, 2024
1 parent a1bfdc2 commit 138abc8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/services/utils/networking.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { isObject } from '@sveltia/utils/object';
* A `fetch` wrapper to send an HTTP request to an API endpoint, parse the response as JSON or other
* specified format, and handle errors gracefully.
* @param {string} url - URL.
* @param {{ method?: string, headers?: any, body?: any }} [init] - Request options.
* @param {RequestInit} [init] - Request options.
* @param {object} [options] - Options.
* @param {'json' | 'text' | 'blob' | 'raw'} [options.responseType] - Response parser type. The
* default is `json`. Use `raw` to return a `Response` object as is.
Expand All @@ -16,6 +16,7 @@ export const sendRequest = async (url, init = {}, { responseType = 'json' } = {}
/** @type {Response} */
let response;

init.cache = 'no-cache';
init.headers = new Headers(init.headers);

if (responseType === 'json') {
Expand Down

0 comments on commit 138abc8

Please sign in to comment.