Skip to content

net/http: document panic behavior of CrossOriginProtection.AddInsecureBypassPattern #75226

@gazerro

Description

@gazerro

The CrossOriginProtection.AddInsecureBypassPattern method of the net/http package panics if the given pattern conflicts with one that is already bypassed.

This could be inferred from the method's documentation, which states:

The pattern syntax and precedence rules are the same as [ServeMux](https://pkg.go.dev/net/[email protected]#ServeMux).

However, in the ServeMux documentation it is explicitly noted that ServeMux.Handle and ServeMux.HandleFunc may panic, while this is not mentioned for CrossOriginProtection.AddInsecureBypassPattern.

I suggest updating the documentation of both AddInsecureBypassPattern and ServeMux to clearly indicate which methods may panic in case of a conflict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions