requestjs-rails 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/requestjs.js +14 -8
- data/lib/requestjs/version.rb +1 -1
- metadata +5 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: adf29b43dd99b9910bfc96f081f7e8c182b510ab96c21266d2a82c4279041471
|
|
4
|
+
data.tar.gz: 9e145132e9bdb91eb8c6fb5d5e71e7d45ee54b90bada851770363ab4ea3b9a71
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 84156224aa4fff4c18f76cbe09f764f926ddcdac5caea9414cbb46450e030779017d127b94ca572e3e775dd4959c9d2c2615d3cb8618c608a58342d985dc3950
|
|
7
|
+
data.tar.gz: '08e15d8f20c6e6c57585205ba00353e333212032f6de16b86a1330029a898a101be38bcf92fd688e771ae3cda4fe150caf04ea4b8bab7a5ec995b5a831495b96'
|
|
@@ -63,9 +63,11 @@ class FetchResponse {
|
|
|
63
63
|
if (this.isScript) {
|
|
64
64
|
const script = document.createElement("script");
|
|
65
65
|
const metaTag = document.querySelector("meta[name=csp-nonce]");
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
if (metaTag) {
|
|
67
|
+
const nonce = metaTag.nonce === "" ? metaTag.content : metaTag.nonce;
|
|
68
|
+
if (nonce) {
|
|
69
|
+
script.setAttribute("nonce", nonce);
|
|
70
|
+
}
|
|
69
71
|
}
|
|
70
72
|
script.innerHTML = await this.text;
|
|
71
73
|
document.body.appendChild(script);
|
|
@@ -90,7 +92,7 @@ class RequestInterceptor {
|
|
|
90
92
|
function getCookie(name) {
|
|
91
93
|
const cookies = document.cookie ? document.cookie.split("; ") : [];
|
|
92
94
|
const prefix = `${encodeURIComponent(name)}=`;
|
|
93
|
-
const cookie = cookies.find(
|
|
95
|
+
const cookie = cookies.find(cookie => cookie.startsWith(prefix));
|
|
94
96
|
if (cookie) {
|
|
95
97
|
const value = cookie.split("=").slice(1).join("=");
|
|
96
98
|
if (value) {
|
|
@@ -116,7 +118,7 @@ function metaContent(name) {
|
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
function stringEntriesFromFormData(formData) {
|
|
119
|
-
return [ ...formData ].reduce((
|
|
121
|
+
return [ ...formData ].reduce((entries, [name, value]) => entries.concat(typeof value === "string" ? [ [ name, value ] ] : []), []);
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
function mergeEntries(searchParams, entries) {
|
|
@@ -146,7 +148,7 @@ class FetchRequest {
|
|
|
146
148
|
} catch (error) {
|
|
147
149
|
console.error(error);
|
|
148
150
|
}
|
|
149
|
-
const fetch =
|
|
151
|
+
const fetch = window.Turbo ? window.Turbo.fetch : window.fetch;
|
|
150
152
|
const response = new FetchResponse(await fetch(this.url, this.fetchOptions));
|
|
151
153
|
if (response.unauthenticated && response.authenticationURL) {
|
|
152
154
|
return Promise.reject(window.location.href = response.authenticationURL);
|
|
@@ -166,7 +168,7 @@ class FetchRequest {
|
|
|
166
168
|
this.options.headers = headers;
|
|
167
169
|
}
|
|
168
170
|
sameHostname() {
|
|
169
|
-
if (!this.originalUrl.startsWith("http:")) {
|
|
171
|
+
if (!this.originalUrl.startsWith("http:") && !this.originalUrl.startsWith("https:")) {
|
|
170
172
|
return true;
|
|
171
173
|
}
|
|
172
174
|
try {
|
|
@@ -182,7 +184,8 @@ class FetchRequest {
|
|
|
182
184
|
body: this.formattedBody,
|
|
183
185
|
signal: this.signal,
|
|
184
186
|
credentials: this.credentials,
|
|
185
|
-
redirect: this.redirect
|
|
187
|
+
redirect: this.redirect,
|
|
188
|
+
keepalive: this.keepalive
|
|
186
189
|
};
|
|
187
190
|
}
|
|
188
191
|
get headers() {
|
|
@@ -260,6 +263,9 @@ class FetchRequest {
|
|
|
260
263
|
get credentials() {
|
|
261
264
|
return this.options.credentials || "same-origin";
|
|
262
265
|
}
|
|
266
|
+
get keepalive() {
|
|
267
|
+
return this.options.keepalive || false;
|
|
268
|
+
}
|
|
263
269
|
get additionalHeaders() {
|
|
264
270
|
return this.options.headers || {};
|
|
265
271
|
}
|
data/lib/requestjs/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: requestjs-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marcelo Lauxen
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2025-12-11 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: railties
|
|
@@ -16,15 +15,14 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
18
|
+
version: 7.1.0
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
27
|
-
description:
|
|
25
|
+
version: 7.1.0
|
|
28
26
|
email: marcelolauxen16@gmail.com
|
|
29
27
|
executables: []
|
|
30
28
|
extensions: []
|
|
@@ -46,7 +44,6 @@ homepage: https://github.com/marcelolx/requestjs-rails
|
|
|
46
44
|
licenses:
|
|
47
45
|
- MIT
|
|
48
46
|
metadata: {}
|
|
49
|
-
post_install_message:
|
|
50
47
|
rdoc_options: []
|
|
51
48
|
require_paths:
|
|
52
49
|
- lib
|
|
@@ -61,8 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
61
58
|
- !ruby/object:Gem::Version
|
|
62
59
|
version: '0'
|
|
63
60
|
requirements: []
|
|
64
|
-
rubygems_version: 3.
|
|
65
|
-
signing_key:
|
|
61
|
+
rubygems_version: 3.6.2
|
|
66
62
|
specification_version: 4
|
|
67
63
|
summary: A tiny Fetch API wrapper that allows you to make http requests without need
|
|
68
64
|
to handle to send the CSRF Token on every request
|