YTKNetwork icon indicating copy to clipboard operation
YTKNetwork copied to clipboard

请问如何给所有请求统一加header请求头

Open Bruce-pac opened this issue 6 years ago • 4 comments

提出问题前请先确认完成了下列几项步骤 New Issue Checklist

  • [x] 我已经阅读过 贡献指南 I have read and understood the CONTRIBUTING guide
  • [x] 我已经阅读过 程序文档 I have read the Documentation
  • [x] 我已经证实这个问题来源于 YTKNetwork 本身,而不是其所依赖的 AFNetworking I have confirmed that this issue is caused by YTKNetwork, not AFNetworking
  • [x] 我已经在项目的 问题列表 中搜索过并且没有找到类似问题 I have searched for a similar issue in the project and found none

问题描述 Issue Description

请给出所提出问题的详尽描述,包括具体的错误信息,打印的堆栈等等,以及重现此问题的具体步骤。

Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.

Bruce-pac avatar Oct 19 '17 14:10 Bruce-pac

继承 YTKRequest 实现自定义基类。

sunnyyoung avatar Oct 19 '17 14:10 sunnyyoung

接口类太多,不可能一个个改基类。希望开发者能在YTKUrlFilterProtocol里面加个过滤header的方法,或者提供requestHeaderFieldValueDictionary的set方法

Bruce-pac avatar Oct 20 '17 02:10 Bruce-pac

@Bruce-pac 使用这个YTKUrlArgumentsFilter类设置公共参数可以满足要求吗?

xhp281 avatar Feb 26 '18 09:02 xhp281

@xhp281 查询参数的话可以,header的话不行,可以用YTKBaseRequest的分类重写requestHeaderFieldValueDictionary方法,或者子类化

Bruce-pac avatar Feb 27 '18 14:02 Bruce-pac