microsoft / microsoft/azure-devops-python-api

append_log_content returns HTTP 400 (Content-Length not set)

Aberta
#419 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Linguagem predominante
Python
Estrelas
684
Forks
218
Merge médio
8d 10h
PRs com merge (30d)
1

Descrição

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)

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece pelo ponto de entrada append_log_content mostrado na issue e inspecione como a chamada a _send constrói os headers para conteúdo application/octet-stream. Reproduza a requisição ao Azure DevOps Server 2020 e verifique se a requisição inclui Content-Length e não retorna mais HTTP 400.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
azure, python
Domínio
api
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.