Skip to content

Docs have broken sample code #1098

@CamJN

Description

@CamJN

If you look at https://api.vapor.codes/vapor/documentation/vapor/niohttp1/httpheaders/accept#discussion, you will see the following sample code:

You can access all MediaTypes in this collection to check membership.
httpReq.accept.mediaTypes.contains(.html)

This has two issues: first, accept is available on httpReq.headers not directly on httpReq; and second, mediaTypes.contains only accepts a predicate-closure, not an HTTPMediaType as is shown.

Tested with swift 6.2 due to needing new macOS apis for my project.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions