@server/next 0.40.2 → 0.40.3

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.
Files changed (2) hide show
  1. package/index.js +7 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3158,8 +3158,14 @@ function ServerTest(app) {
3158
3158
  options.headers["content-type"] = "application/json";
3159
3159
  options.body = JSON.stringify(options.body);
3160
3160
  }
3161
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(path) && !/^https?:\/\//i.test(path)) {
3162
+ throw new Error(
3163
+ `Only http(s) URLs can be tested, received "${path}". Pass a path, or the full URL of the host the request should hit.`
3164
+ );
3165
+ }
3166
+ const url = /^https?:\/\//i.test(path) ? path : `http://localhost:${port}${path}`;
3161
3167
  return await app.fetch(
3162
- new Request(`http://localhost:${port}${path}`, {
3168
+ new Request(url, {
3163
3169
  method,
3164
3170
  ...options
3165
3171
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@server/next",
3
- "version": "0.40.2",
3
+ "version": "0.40.3",
4
4
  "description": "A fully-fledged web server with routing, file uploads, sessions, static files, schema validation, websockets, testing, etc.",
5
5
  "homepage": "https://server-js.com/",
6
6
  "repository": "github:franciscop/server-next",