adonisjs / http-server

AdonisJS HTTP Server along with its Router
https://docs.adonisjs.com/guides/http
MIT License
112 stars 28 forks source link

makeUrl error in types #40

Closed Xstoudi closed 3 years ago

Xstoudi commented 3 years ago

The makeUrl signature indicate that the second parameter can be a MakeUrlOptions :

public makeUrl(
  routeIdentifier: string,
  params?: any[] | MakeUrlOptions,
  options?: MakeUrlOptions
): string

But when passing a MakeUrlOptions as a second parameter:

router.makeUrl('/posts', { prefixUrl: '/api' })

it returns /posts when /api/posts is expected.

Package version

v5.2.1

Node.js and npm version

v15.11.0

Sample Code (to reproduce the issue)

router.makeUrl('/posts', { prefixUrl: '/api' }) // /posts

and

router.makeUrl('/posts', undefined, { prefixUrl: '/api' }) // /api/posts
thetutlage commented 3 years ago

Closing since not actionable