CircleCI-Archived / api-preview-docs

In-progress docs about the pre-release preview of CircleCI API v2
72 stars 39 forks source link

Body parser is not tolerant of whitespace?? #66

Closed grncdr closed 4 years ago

grncdr commented 4 years ago

The docs have this example request:

curl -u ${CIRCLECI_TOKEN}: -X POST --header "Content-Type: application/json" -d '{
  "branch": "dev"
}' https://circleci.com/api/v2/project/${project_slug}/pipeline

However, whenever I include "branch" in my request body (even just {"branch": "master"}) I get a response that says {"message": "Invalid JSON body."}.

What I really want to do is pass a git commit hash, to trigger a parameterized pipeline for a specific commit, is that intended to be supported?

grncdr commented 4 years ago

A bit more debugging has revealed that I seem to get different results depending on whitespace in the JSON body. {"branch":"master"} works while {"branch": "master"} fails.

gordonsyme commented 4 years ago

Hi there,

I'm not able to reproduce this, would you mind contacting our support folks so you can provide specifics of your repo? That'll give me somewhere to start investigating from.

Also, our JSON parser won't accept much of the unicode whitespace set (U+0085 and above), would you mind double checking that there isn't any of that in the JSON body you are providing?

Thanks

gordonsyme commented 4 years ago

Gonna close this now, please do reach out to support if you're still having trouble.