@nxtedition/lib 23.5.11 → 23.5.13
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.
- package/couch.js +2 -1
- package/http.js +6 -1
- package/package.json +1 -1
package/couch.js
CHANGED
|
@@ -7,6 +7,7 @@ import { defaultDelay as delay } from './http.js'
|
|
|
7
7
|
import urljoin from 'url-join'
|
|
8
8
|
import { AbortError } from './errors.js'
|
|
9
9
|
import { dispatch, Agent, Pool, request as undiciRequest } from '@nxtedition/nxt-undici'
|
|
10
|
+
import urlJoin from 'url-join'
|
|
10
11
|
|
|
11
12
|
export function makeCouch(opts) {
|
|
12
13
|
let config
|
|
@@ -254,7 +255,7 @@ export function makeCouch(opts) {
|
|
|
254
255
|
const query = { ...params, feed: live ? 'continuous' : 'normal' }
|
|
255
256
|
|
|
256
257
|
const ureq = {
|
|
257
|
-
path:
|
|
258
|
+
path: urlJoin(dbPathname, '/_changes'),
|
|
258
259
|
origin: dbOrigin,
|
|
259
260
|
query,
|
|
260
261
|
headers: body
|
package/http.js
CHANGED
|
@@ -73,6 +73,11 @@ export class Context {
|
|
|
73
73
|
if (this.#url === undefined) {
|
|
74
74
|
this.#url = requestTarget(this.#req)
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
if (!this.#url) {
|
|
78
|
+
throw new createError.BadRequest('invalid url')
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
return this.#url
|
|
77
82
|
}
|
|
78
83
|
|
|
@@ -236,7 +241,7 @@ export async function requestMiddleware(ctx, next) {
|
|
|
236
241
|
logger.error({ res, err, elapsedTime }, 'request error')
|
|
237
242
|
}
|
|
238
243
|
} else {
|
|
239
|
-
if (req.aborted || err.name === 'AbortError') {
|
|
244
|
+
if (req.aborted || (!res.errored && res.closed) || err.name === 'AbortError') {
|
|
240
245
|
logger.debug({ res, err, elapsedTime }, 'request aborted')
|
|
241
246
|
} else if (statusCode < 500) {
|
|
242
247
|
logger.warn({ res, err, elapsedTime }, 'request failed')
|