Something I've noticed when using Pantry is that although for the most part the API does return a JSON response, there are a few instances where it just.. doesn't. This is even shown (to an extent) in the Pantry Documentation in the examples, but if this is intentional behavior, I really don't think it's as clearly stated as it probably should be.
Although this mainly applies to the create/delete basket requests, I've noticed it in the the too many requests and pantry not found response too; that one being a string can definitely throw off a lot, especially as it would usually come entirely unexpected, likely causing an error in the program that requested it.