microsoft / microsoft/azure-devops-python-api

append_log_content returns HTTP 400 (Content-Length not set)

オープン
#419 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
684
フォーク
218
平均マージ
8日 10時間
マージ済み PR(30日)
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)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. 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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。