Skip to content

HTTPClient 支持模拟 HEAD 请求 #18

Description

@TechQuery

Task description

核心逻辑

HEAD 请求失败后,依次用以下方式模拟:

  1. 发起一次含 Range 请求头的 GET 请求,仅读取文件头,长度以魔数为准:https://github.com/sindresorhus/file-type/blob/main/core.js
  2. Range 也不支持时,发起一次普通 GET 请求,读取 response.body 文件头后终止读流

参考代码

https://github.com/idea2app/work-counter/blob/7cb7d80f3371423746ba36067759df9a7a23a6aa/source/utility/File.ts#L19-L40

Reward currency

TQT $

Reward amount

45

Reward payer

石垚 tech-query@idea2app.cn

Task source

https://idea2app.feishu.cn/record/QnkKrPh9JeZPo6cKdaScMwHUnXg

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions