API returns URL encoded branch names in JSON response

api

#1

Hi all,

A recent bug report on a Go SDK I maintain (https://github.com/jszwedko/go-circleci/issues/17) that wraps the CircleCI API pointed out that the response from the /projects endpoint returns URL encoded branch names, e.g. release/0.1.0 is returned as release%2F0%2E1%2E0. Is this intentional? As the response type is application/json I found this surprising.

I’ve created a gist with an example response: https://gist.github.com/jszwedko/46094cec4d3048cfd71e3801d9a6d0f1

Thank you!

-Jesse


#2

Nothing jumps out. Filing a bug with Engineering now. Is this breaking your SDK in a meaningful way (trying to gauge relative importance if its not an easy fix).


#3

Hey! Thanks for taking a look. It isn’t breaking the SDK, per se, but a user of the SDK found it surprising that the value was being returned URL encoded (I just pass it back as a string). Rather than me having the SDK URL decode it, I figured I’d check if this was intentional first.


#4

Just wanted to check in on this. @rishimkumar were you able to determine if this behavior was intentional?


#5

Hey @jszwedko - I discussed with Engineering. Appears this has been the behavior for years. and now we’ll run the age-old software dilemma of bug/feature if people rely on it.
A bit surprising to everyone, but it’s unlikely to be targeted for change anytime soon.
I still want to thank you for raising it as if we touch code in that area, we will discuss switching that up.


#6

Hi @rishimkumar; thanks for following up on this! I thought that might be the case and I understand the motivation for not changing it. I can update my SDK to handle the URL decoding.


#7