jocxfin / pwgen

Simple self hosted password generator
GNU Affero General Public License v3.0
62 stars 5 forks source link

[BUG]`Uncaught (in promise) TypeError: Failed to execute 'put' on 'Cache': Request method 'POST' is unsupported` #53

Closed jocxfin closed 7 months ago

jocxfin commented 7 months ago

Describe the bug Uncaught (in promise) TypeError: Failed to execute 'put' on 'Cache': Request method 'POST' is unsupported

To Reproduce Steps to reproduce the behavior:

  1. Implement a service worker with caching functionality for a web application.
  2. Include caching of all request types, not limiting to GET requests.
  3. Attempt to cache a POST request.
  4. Observe the error: Uncaught (in promise) TypeError: Failed to execute 'put' on 'Cache': Request method 'POST' is unsupported in the console.

Expected behavior The service worker should only cache GET requests and ignore others, especially POST requests, to avoid triggering errors.

Screenshots N/A

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context This issue arises due to the Cache API's limitation, which only supports caching of GET requests. Implementing a check for the request method before caching can mitigate this issue.