@cappitolian/http-local-server-swifter 0.0.31 → 0.0.33
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.
|
@@ -267,6 +267,15 @@ public class HttpLocalServerSwifter {
|
|
|
267
267
|
if (body != null)
|
|
268
268
|
requestData.put("body", body);
|
|
269
269
|
|
|
270
|
+
// Add headers
|
|
271
|
+
JSObject headersObj = new JSObject();
|
|
272
|
+
|
|
273
|
+
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
|
274
|
+
headersObj.put(entry.getKey(), entry.getValue());
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
requestData.put("headers", headersObj);
|
|
278
|
+
|
|
270
279
|
CompletableFuture<String> future = new CompletableFuture<>();
|
|
271
280
|
pendingResponses.put(requestId, future);
|
|
272
281
|
|
|
@@ -295,7 +304,7 @@ public class HttpLocalServerSwifter {
|
|
|
295
304
|
response.addHeader("Access-Control-Allow-Origin", "*");
|
|
296
305
|
response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS");
|
|
297
306
|
response.addHeader("Access-Control-Allow-Headers",
|
|
298
|
-
"Origin, Content-Type, Accept, Authorization, X-Requested-With");
|
|
307
|
+
"Origin, Content-Type, Accept, Authorization, X-Requested-With, x-api-key");
|
|
299
308
|
response.addHeader("Access-Control-Max-Age", "3600");
|
|
300
309
|
// Prevents TCP connection reuse. NanoHTTPD does not handle keep-alive
|
|
301
310
|
// correctly under rapid sequential requests, causing ERR_INVALID_HTTP_RESPONSE.
|
|
@@ -186,7 +186,7 @@ public protocol HttpLocalServerSwifterDelegate: AnyObject {
|
|
|
186
186
|
"Content-Type": "application/json",
|
|
187
187
|
"Access-Control-Allow-Origin": "*",
|
|
188
188
|
"Access-Control-Allow-Methods": "GET, POST, PUT, PATCH, DELETE, OPTIONS",
|
|
189
|
-
"Access-Control-Allow-Headers": "Origin, Content-Type, Accept, Authorization, X-Requested-With"
|
|
189
|
+
"Access-Control-Allow-Headers": "Origin, Content-Type, Accept, Authorization, X-Requested-With, x-api-key"
|
|
190
190
|
]
|
|
191
191
|
|
|
192
192
|
if
|
|
@@ -210,7 +210,7 @@ public protocol HttpLocalServerSwifterDelegate: AnyObject {
|
|
|
210
210
|
return .raw(204, "No Content", [
|
|
211
211
|
"Access-Control-Allow-Origin": "*",
|
|
212
212
|
"Access-Control-Allow-Methods": "GET, POST, PUT, PATCH, DELETE, OPTIONS",
|
|
213
|
-
"Access-Control-Allow-Headers": "Origin, Content-Type, Accept, Authorization, X-Requested-With",
|
|
213
|
+
"Access-Control-Allow-Headers": "Origin, Content-Type, Accept, Authorization, X-Requested-With, x-api-key",
|
|
214
214
|
"Access-Control-Max-Age": "86400"
|
|
215
215
|
], nil)
|
|
216
216
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cappitolian/http-local-server-swifter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"description": "Runs a local HTTP server on your device, accessible over LAN. Supports connect, disconnect, GET, and POST methods with IP and port discovery.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|