Fixing an issue with typing + wrong parameter being passed to the direct Couch call functionality.
This commit is contained in:
parent
b457bee2fc
commit
070659c7b1
|
@ -21,6 +21,7 @@ import { WriteStream, ReadStream } from "fs"
|
||||||
import { newid } from "../../docIds/newid"
|
import { newid } from "../../docIds/newid"
|
||||||
import { SQLITE_DESIGN_DOC_ID } from "../../constants"
|
import { SQLITE_DESIGN_DOC_ID } from "../../constants"
|
||||||
import { DDInstrumentedDatabase } from "../instrumentation"
|
import { DDInstrumentedDatabase } from "../instrumentation"
|
||||||
|
import { checkSlashesInUrl } from "../../helpers"
|
||||||
|
|
||||||
const DATABASE_NOT_FOUND = "Database does not exist."
|
const DATABASE_NOT_FOUND = "Database does not exist."
|
||||||
|
|
||||||
|
@ -252,17 +253,18 @@ export class DatabaseImpl implements Database {
|
||||||
async _sqlQuery<T>(
|
async _sqlQuery<T>(
|
||||||
url: string,
|
url: string,
|
||||||
method: "POST" | "GET",
|
method: "POST" | "GET",
|
||||||
body?: any
|
body?: Record<string, any>
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
|
url = checkSlashesInUrl(`${this.couchInfo.sqlUrl}/${url}`)
|
||||||
const args: { url: string; method: string; cookie: string; body?: any } = {
|
const args: { url: string; method: string; cookie: string; body?: any } = {
|
||||||
url: `${this.couchInfo.sqlUrl}/${url}`,
|
url,
|
||||||
method,
|
method,
|
||||||
cookie: this.couchInfo.cookie,
|
cookie: this.couchInfo.cookie,
|
||||||
}
|
}
|
||||||
if (body) {
|
if (body) {
|
||||||
args.body = body
|
args.body = body
|
||||||
}
|
}
|
||||||
const response = await directCouchUrlCall(body)
|
const response = await directCouchUrlCall(args)
|
||||||
if (response.status > 300) {
|
if (response.status > 300) {
|
||||||
throw new Error(await response.text())
|
throw new Error(await response.text())
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ export async function directCouchUrlCall({
|
||||||
url: string
|
url: string
|
||||||
cookie: string
|
cookie: string
|
||||||
method: string
|
method: string
|
||||||
body?: any
|
body?: Record<string, any>
|
||||||
}) {
|
}) {
|
||||||
const params: any = {
|
const params: any = {
|
||||||
method: method,
|
method: method,
|
||||||
|
|
Loading…
Reference in New Issue