Skip to content

Commit 2dc83bb

Browse files
authored
Support 'convert-post-to-get-in-xhr' without service worker (#178)
- ensure XHR override is applied even if not using service worker if 'convert post to get' is true, fixes #158 - bump to 3.8.4 - ci: attempt to fix errant test failures than pop up on ci
1 parent 7da4fdc commit 2dc83bb

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.github/workflows/node.js.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@ jobs:
2727
node-version: 18.x
2828
- run: yarn install
2929
- run: yarn run build-full-test
30+
- id: setup-chrome
31+
uses: browser-actions/setup-chrome@v1
3032
# set up a virtual display for chrome (since the tests don't currently run it in headless mode)
3133
# then run the tests
32-
- run: |
34+
- name: Run Tests
35+
env:
36+
CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
37+
run: |
3338
export DISPLAY=:99
3439
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
3540
yarn test

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@webrecorder/wombat",
3-
"version": "3.8.3",
3+
"version": "3.8.4",
44
"main": "index.js",
55
"license": "AGPL-3.0-or-later",
66
"author": "Ilya Kreymer, Webrecorder Software",

src/wombat.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -4549,7 +4549,9 @@ Wombat.prototype.initHTTPOverrides = function() {
45494549
// responseURL override
45504550
this.overridePropExtract(this.$wbwindow.XMLHttpRequest.prototype, 'responseURL');
45514551

4552-
if (!this.wb_info.isSW) {
4552+
var convertToGet = !!this.wb_info.convert_post_to_get;
4553+
4554+
if (!this.wb_info.isSW && !convertToGet) {
45534555
if (this.$wbwindow.XMLHttpRequest.prototype.open) {
45544556
var origXMLHttpOpen = this.$wbwindow.XMLHttpRequest.prototype.open;
45554557
this.utilFns.XHRopen = origXMLHttpOpen;
@@ -4588,9 +4590,6 @@ Wombat.prototype.initHTTPOverrides = function() {
45884590
this.__WB_xhr_headers.set(name, value);
45894591
};
45904592

4591-
var wombat = this;
4592-
var convertToGet = !!this.wb_info.convert_post_to_get;
4593-
45944593
this.$wbwindow.XMLHttpRequest.prototype.send = async function(value) {
45954594
if (convertToGet && (this.__WB_xhr_open_arguments[0] === 'POST' || this.__WB_xhr_open_arguments[0] === 'PUT')) {
45964595

0 commit comments

Comments
 (0)