microsoft / microsoft/azure-devops-python-api
append_log_content returns HTTP 400 (Content-Length not set)
未关闭
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 684
- 派生
- 218
- 平均合并
- 8 天 10 小时
- 30 天内合并 PR
- 1
描述
When using append_log_content, it returns HTTP 400 status code, and '{"count":55,"value":"ContentLength header must be specified to create a log."}'
DevOps: Azure DevOps Server 2020 update 1.1
azure-devops-python-api: 6.0.0b4
I workaround it with an explicit Content-Length header:
def append_log_content(self, content, scope_identifier, hub_name, plan_id, log_id):
"""AppendLogContent.
:param bytes content: The content to be append
:param str scope_identifier: The project GUID to scope the request
:param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server
:param str plan_id:
:param int log_id:
:rtype: :class:`<TaskLog> <azure.devops.v5_1.task.models.TaskLog>`
"""
route_values = {}
if scope_identifier is not None:
route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str')
if hub_name is not None:
route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str')
if plan_id is not None:
route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str')
if log_id is not None:
route_values['logId'] = self._serialize.url('log_id', log_id, 'int')
response = self._send(http_method='POST',
location_id='46f5667d-263a-4684-91b1-dff7fdcf64e2',
version='5.1',
route_values=route_values,
content=content,
media_type='application/octet-stream',
additional_headers={"Content-Length": len(content)})
return self._deserialize('TaskLog', response)
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中所示的 append_log_content 入口点开始,检查其 _send 调用如何为 application/octet-stream 内容构造标头。重现 Azure DevOps Server 2020 请求,然后验证该请求包含 Content-Length 且不再返回 HTTP 400。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- azure, python
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100