gpt4 book ai didi

hapi.js - 为什么我无法在 Hapi 中创建 HEAD 路由?

转载 作者:行者123 更新时间:2023-12-01 19:13:52 26 4
gpt4 key购买 nike

根据文档https://hapijs.com/api/16.0.1#route-configuration路由方法可能不是“HEAD”类型,但我不明白为什么我不能覆盖该行为。

最佳答案

HEAD 路由会随您定义的每个 GET 路由自动创建。因此,您几乎没有理由需要定义自己的。

If you want to optimize your handling of HEAD requests, simply check your GET handler for the method, and if it is head, return an empty response with the correct headers. This is only worth doing for some very expensive GET requests, where you are expecting clients to use HEAD directly.

The main reason not to support it, is that I am expecting very few developers to use this, but it will add an extra lookup for every HEAD request.

这个问题已经得到解决 on Github .

关于hapi.js - 为什么我无法在 Hapi 中创建 HEAD 路由?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41168192/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com