Skip to content

Update PacklinkPrestaShopUtility.php - #73

Open
Usytech51 wants to merge 1 commit into
packlink-dev:masterfrom
Usytech51:patch-2
Open

Usytech51 wants to merge 1 commit into
packlink-dev:masterfrom
Usytech51:patch-2

Conversation

@Usytech51

Copy link
Copy Markdown

fix(ajax): send no-cache headers on JSON responses

Add Cache-Control and Pragma no-cache headers in dieJson() so Packlink AJAX responses are never cached.

The draft-status endpoint (OrderDraft::getDraftStatus) returns JSON with only a Content-Type header. Without cache-control headers, a GET response can be served stale by the browser or an intermediate cache. As a result the order panel kept showing "Draft is currently being created" even after the shipment draft had actually been created on Packlink's side.

Forcing no-store/no-cache on all dieJson() responses makes the status poll always reflect the real state.

fix(ajax): send no-cache headers on JSON responses

Add Cache-Control and Pragma no-cache headers in dieJson() so Packlink
AJAX responses are never cached.

The draft-status endpoint (OrderDraft::getDraftStatus) returns JSON with
only a Content-Type header. Without cache-control headers, a GET response
can be served stale by the browser or an intermediate cache. As a result
the order panel kept showing "Draft is currently being created" even
after the shipment draft had actually been created on Packlink's side.

Forcing no-store/no-cache on all dieJson() responses makes the status
poll always reflect the real state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant