Skip to content

NewRouter for servers section throw exception if no path is specified #407

@NaerChang2

Description

@NaerChang2

Following servers section is causing exception because URL.EscapedPath() returns empty and index access is missing length check.

servers:
  - url: https://example.com

So it's causing line 46 to throw out of index exception.

if path[len(path)-1] == '/' {
	...
}

For better user experience a simple len(path) check will be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions