From 9091f4ab0aede472deb58eb7db52deb29a2ed816 Mon Sep 17 00:00:00 2001 From: Michal Kaminski <32871390+michal-b-kaminski@users.noreply.github.com> Date: Wed, 6 Feb 2019 21:52:17 +0100 Subject: [PATCH] Add optional method property in object form of pathFilter --- types/express-unless/express-unless-tests.ts | 4 +++- types/express-unless/index.d.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/express-unless/express-unless-tests.ts b/types/express-unless/express-unless-tests.ts index 56d1a72574..859d72286d 100644 --- a/types/express-unless/express-unless-tests.ts +++ b/types/express-unless/express-unless-tests.ts @@ -14,4 +14,6 @@ app.use(middleware.unless({ path: "/index", useOriginalUrl: true })); app.use(middleware.unless({ path: /home/g, ext: ".jpg" })); app.use(middleware.unless({ path: { url: "/index" }, ext: [ ".html", ".htm" ] })); app.use(middleware.unless({ path: { url: "/index", methods: [ "GET", "POST" ] } })); -app.use(middleware.unless({ path: [ "/index", "/home", /home/i, { url: "/main", methods: [ "GET" ] }, { url: /home/i } ] })); \ No newline at end of file +app.use(middleware.unless({ path: [ "/index", "/home", /home/i, { url: "/main", methods: [ "GET" ] }, { url: /home/i } ] })); +app.use(middleware.unless({ path: [ "/index", "/home", /home/i, { url: "/main", method: "GET" }, { url: /home/i } ] })); +app.use(middleware.unless({ path: [ "/index", "/home", /home/i, { url: "/main", method: [ "GET" ] }, { url: /home/i } ] })); \ No newline at end of file diff --git a/types/express-unless/index.d.ts b/types/express-unless/index.d.ts index c98516a411..601cc199fc 100644 --- a/types/express-unless/index.d.ts +++ b/types/express-unless/index.d.ts @@ -12,7 +12,7 @@ declare function unless(options: unless.Options): express.RequestHandler; declare function unless(options: unless.Options["custom"]): express.RequestHandler; declare namespace unless { - type pathFilter = string | RegExp | { url: string | RegExp, methods?: string[] }; + type pathFilter = string | RegExp | { url: string | RegExp, methods?: string[], method?: string | string[] }; export interface Options { custom?: (req: express.Request) => boolean;