ITADN
vapor/docs/Issues

Docs have broken sample code

#1098ClosedCamJN 创建于 2025-09-04
invalid codegood first issue
C
CamJNcommented
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.
关闭于 2025-11-03 4 条评论