Skip to content

fix: resolve 406 error on pipeline step log by using correct Accept header#2

Open
alionar wants to merge 3 commits intozach-snell:mainfrom
alionar:fix/pipeline-step-log-406
Open

fix: resolve 406 error on pipeline step log by using correct Accept header#2
alionar wants to merge 3 commits intozach-snell:mainfrom
alionar:fix/pipeline-step-log-406

Conversation

@alionar
Copy link

@alionar alionar commented Mar 4, 2026

Description

bbkt pipelines log and the MCP get-step-log action both fail with HTTP 406 Not Acceptable.
The do() method in client.go hardcodes Accept: application/json on every request. Problem is, the step log endpoint (/2.0/repositories/.../steps/{uuid}/log) only serves application/octet-stream and it's raw text, not JSON. So the API rejects the request.

GetRaw() was supposed to handle non-JSON responses (it even says "returns raw bytes" in its doc comment), but it calls do() and inherits the JSON accept header anyway.

Fix: added a variadic accept parameter to do(). Defaults to application/json so nothing else breaks. GetRaw() now passes application/octet-stream.

Screenshot 2026-03-03 at 16 48 16

Ref: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pipelines/#api-repositories-workspace-repo-slug-pipelines-pipeline-uuid-steps-step-uuid-log-get-response

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Include commands and environments (e.g. CLI directly, or loaded into Claude Desktop as an MCP server).

  • go test -race ./... runs successfully
  • golangci-lint run ./... runs successfully

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant