microsoft / microsoft/azure-devops-python-api

append_log_content returns HTTP 400 (Content-Length not set)

Abierto
#419 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Python
Estrellas
684
Forks
218
Merge medio
8 d 10 h
PR fusionados (30 d)
1

Descripción

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)

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comience en el punto de entrada append_log_content mostrado en el issue e inspeccione cómo su llamada a _send construye las cabeceras para contenido application/octet-stream. Reproduzca la solicitud a Azure DevOps Server 2020 y verifique que la solicitud incluya Content-Length y ya no devuelva HTTP 400.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
azure, python
Área
api
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.