Coder Social home page Coder Social logo

Comments (4)

birdspider avatar birdspider commented on June 15, 2024 1

update: this seems to be a firefox thing, chromium does set if-modified-since headers (or allows the cache interceptor to set them)

from axios-cache-interceptor.

birdspider avatar birdspider commented on June 15, 2024 1

update2: chrome https://bugs.chromium.org/p/chromium/issues/detail?id=1086809 does not show 304 in the status column but 200

As it stands, I do not think to have found a bug. Instead I found inconsistencies in FF cache handling and display issues in Chrome, I'll close this.

from axios-cache-interceptor.

arthurfiorette avatar arthurfiorette commented on June 15, 2024

I don't know how to enable debug mode when using simple cdn scripts.

https://axios-cache-interceptor.js.org/guide/getting-started#install-axios-cache-interceptor

Please attach debug logs.

from axios-cache-interceptor.

birdspider avatar birdspider commented on June 15, 2024

my bad, I didn't see that /dev is just a folder

[
  "no cache, first",
  {
    "id": "-87358114",
    "msg": "Sending request, waiting for response",
    "data": {
      "overrideCache": false,
      "state": "empty"
    }
  },
  {
    "id": "-87358114",
    "msg": "Cache header interpreted as 'dont cache'",
    "data": {
      "cache": {
        "state": "loading",
        "previous": "empty"
      },
      "response": {
        "data": {
          "data": [
            "test"
          ]
        },
        "status": 200,
        "statusText": "OK",
        "headers": {
          "age": "0",
          "cache-control": "no-store",
          "connection": "close",
          "content-type": "application/json",
          "date": "Thu, 05 Oct 2023 22:00:47 GMT",
          "host": "localhost:3000",
          "last-modified": "Thu, 05 Oct 2023 22:00:42 GMT",
          "x-powered-by": "PHP/8.2.11",
          "x-axios-cache-last-modified": "use-cache-timestamp"
        },
        "config": {
          "transitional": {
            "silentJSONParsing": true,
            "forcedJSONParsing": true,
            "clarifyTimeoutError": false
          },
          "adapter": [
            "xhr",
            "http"
          ],
          "transformRequest": [
            null
          ],
          "transformResponse": [
            null
          ],
          "timeout": 0,
          "xsrfCookieName": "XSRF-TOKEN",
          "xsrfHeaderName": "X-XSRF-TOKEN",
          "maxContentLength": -1,
          "maxBodyLength": -1,
          "env": {},
          "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": null
          },
          "baseURL": "http://localhost:3000",
          "withCredentials": true,
          "cache": {
            "update": {},
            "ttl": 300000,
            "methods": [
              "get",
              "head"
            ],
            "cachePredicate": {},
            "etag": true,
            "modifiedSince": true,
            "interpretHeader": true,
            "cacheTakeover": false,
            "staleIfError": true,
            "override": false
          },
          "method": "get",
          "url": "/?id=3",
          "id": "-87358114"
        },
        "request": {},
        "id": "-87358114",
        "cached": false
      },
      "expirationTime": "dont cache"
    }
  },
  "no cache, again",
  {
    "id": "-87358114",
    "msg": "Sending request, waiting for response",
    "data": {
      "overrideCache": false,
      "state": "empty"
    }
  },
  {
    "id": "-87358114",
    "msg": "Cache header interpreted as 'dont cache'",
    "data": {
      "cache": {
        "state": "loading",
        "previous": "empty"
      },
      "response": {
        "data": {
          "data": [
            "test"
          ]
        },
        "status": 200,
        "statusText": "OK",
        "headers": {
          "age": "0",
          "cache-control": "no-store",
          "connection": "close",
          "content-type": "application/json",
          "date": "Thu, 05 Oct 2023 22:00:47 GMT",
          "host": "localhost:3000",
          "last-modified": "Thu, 05 Oct 2023 22:00:42 GMT",
          "x-powered-by": "PHP/8.2.11",
          "x-axios-cache-last-modified": "use-cache-timestamp"
        },
        "config": {
          "transitional": {
            "silentJSONParsing": true,
            "forcedJSONParsing": true,
            "clarifyTimeoutError": false
          },
          "adapter": [
            "xhr",
            "http"
          ],
          "transformRequest": [
            null
          ],
          "transformResponse": [
            null
          ],
          "timeout": 0,
          "xsrfCookieName": "XSRF-TOKEN",
          "xsrfHeaderName": "X-XSRF-TOKEN",
          "maxContentLength": -1,
          "maxBodyLength": -1,
          "env": {},
          "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": null
          },
          "baseURL": "http://localhost:3000",
          "withCredentials": true,
          "cache": {
            "update": {},
            "ttl": 300000,
            "methods": [
              "get",
              "head"
            ],
            "cachePredicate": {},
            "etag": true,
            "modifiedSince": true,
            "interpretHeader": true,
            "cacheTakeover": false,
            "staleIfError": true,
            "override": false
          },
          "method": "get",
          "url": "/?id=3",
          "id": "-87358114"
        },
        "request": {},
        "id": "-87358114",
        "cached": false
      },
      "expirationTime": "dont cache"
    }
  },
  "with cache, first",
  {
    "id": "-87350695",
    "msg": "Sending request, waiting for response",
    "data": {
      "overrideCache": false,
      "state": "empty"
    }
  },
  {
    "id": "-87350695",
    "msg": "Useful response configuration found",
    "data": {
      "cacheConfig": {
        "update": {},
        "ttl": 300000,
        "methods": [
          "get",
          "head"
        ],
        "cachePredicate": {},
        "etag": true,
        "modifiedSince": true,
        "interpretHeader": true,
        "cacheTakeover": false,
        "staleIfError": true,
        "override": false
      },
      "cacheResponse": {
        "data": {
          "data": [
            "test"
          ]
        },
        "status": 200,
        "statusText": "OK",
        "headers": {
          "age": "0",
          "cache-control": "max-age:5, must-revalidate, private",
          "connection": "close",
          "content-type": "application/json",
          "date": "Thu, 05 Oct 2023 22:00:47 GMT",
          "host": "localhost:3000",
          "last-modified": "Thu, 05 Oct 2023 22:00:42 GMT",
          "x-powered-by": "PHP/8.2.11",
          "x-axios-cache-last-modified": "use-cache-timestamp",
          "x-axios-cache-stale-if-error": "300000"
        }
      }
    }
  },
  {
    "id": "-87350695",
    "msg": "Found waiting deferred(s) and resolved them"
  },
  {
    "id": "-87350695",
    "msg": "Response cached",
    "data": {
      "cache": {
        "state": "cached",
        "ttl": 300000,
        "createdAt": 1696543247352,
        "data": {
          "data": {
            "data": [
              "test"
            ]
          },
          "status": 200,
          "statusText": "OK",
          "headers": {
            "age": "0",
            "cache-control": "max-age:5, must-revalidate, private",
            "connection": "close",
            "content-type": "application/json",
            "date": "Thu, 05 Oct 2023 22:00:47 GMT",
            "host": "localhost:3000",
            "last-modified": "Thu, 05 Oct 2023 22:00:42 GMT",
            "x-powered-by": "PHP/8.2.11",
            "x-axios-cache-last-modified": "use-cache-timestamp",
            "x-axios-cache-stale-if-error": "300000"
          }
        }
      },
      "response": {
        "data": {
          "data": [
            "test"
          ]
        },
        "status": 200,
        "statusText": "OK",
        "headers": {
          "age": "0",
          "cache-control": "max-age:5, must-revalidate, private",
          "connection": "close",
          "content-type": "application/json",
          "date": "Thu, 05 Oct 2023 22:00:47 GMT",
          "host": "localhost:3000",
          "last-modified": "Thu, 05 Oct 2023 22:00:42 GMT",
          "x-powered-by": "PHP/8.2.11",
          "x-axios-cache-last-modified": "use-cache-timestamp",
          "x-axios-cache-stale-if-error": "300000"
        },
        "config": {
          "transitional": {
            "silentJSONParsing": true,
            "forcedJSONParsing": true,
            "clarifyTimeoutError": false
          },
          "adapter": [
            "xhr",
            "http"
          ],
          "transformRequest": [
            null
          ],
          "transformResponse": [
            null
          ],
          "timeout": 0,
          "xsrfCookieName": "XSRF-TOKEN",
          "xsrfHeaderName": "X-XSRF-TOKEN",
          "maxContentLength": -1,
          "maxBodyLength": -1,
          "env": {},
          "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": null
          },
          "baseURL": "http://localhost:3000",
          "withCredentials": true,
          "cache": {
            "update": {},
            "ttl": 300000,
            "methods": [
              "get",
              "head"
            ],
            "cachePredicate": {},
            "etag": true,
            "modifiedSince": true,
            "interpretHeader": true,
            "cacheTakeover": false,
            "staleIfError": true,
            "override": false
          },
          "method": "get",
          "url": "/?id=4",
          "id": "-87350695"
        },
        "request": {},
        "id": "-87350695",
        "cached": false
      }
    }
  },
  {
    "data": [
      "test"
    ]
  },
  "with cache, again",
  {
    "id": "-87350695",
    "msg": "Returning cached response"
  },
  {
    "id": "-87350695",
    "msg": "Returned cached response"
  },
  "with cache, again after 10s",
  {
    "id": "-87350695",
    "msg": "Returning cached response"
  },
  {
    "id": "-87350695",
    "msg": "Returned cached response"
  }
]

from axios-cache-interceptor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.