forked from wgroeneveld/go-jamming
fix valid domain test for target, not source
This commit is contained in:
parent
b79f113fec
commit
2360186d5a
|
@ -39,7 +39,7 @@ function validate(request) {
|
||||||
isValidUrl(request?.body?.source) &&
|
isValidUrl(request?.body?.source) &&
|
||||||
isValidUrl(request?.body?.target) &&
|
isValidUrl(request?.body?.target) &&
|
||||||
request?.body?.source !== request?.body?.target &&
|
request?.body?.source !== request?.body?.target &&
|
||||||
isValidDomain(request?.body?.source)
|
isValidDomain(request?.body?.target)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function isValidTargetUrl(target) {
|
async function isValidTargetUrl(target) {
|
||||||
|
|
|
@ -20,12 +20,12 @@ describe("webmention receiver validate tests", () => {
|
||||||
|
|
||||||
expect(result).toBe(true)
|
expect(result).toBe(true)
|
||||||
})
|
})
|
||||||
test("is NOT valid if source is a valid url but not form valid domain", () => {
|
test("is NOT valid if target is a valid url but not form valid domain", () => {
|
||||||
const result = validate({
|
const result = validate({
|
||||||
type: "application/x-www-form-urlencoded",
|
type: "application/x-www-form-urlencoded",
|
||||||
body: {
|
body: {
|
||||||
source: urlfrominvaliddomain,
|
source: validhttpsurl + "2",
|
||||||
target: validhttpsurl + "2"
|
target: urlfrominvaliddomain
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue