Trying to delete a DRAFT invoice, but the request / response doesn’t seem to be using JSON? Using the square-ruby-sdk - below are the _request and _response objects from the Square library.
Unsure what or where the Content-Type is being set to x-www-url-form-encoded, vs JSON - immediately prior to this code, I’m successfully executing the Get Invoice call.
web | #<Square::HttpRequest:0x0000000112a03260 @http_method=“DELETE”, @query_url=“https://connect.squareupsandbox.com/v2/invoices/inv%3A0-ChCgRQlWdGNniXj8ZUq-Y-MQEOcI”, @headers={“accept”=>“application/json”, “Authorization”=>“Bearer REMOVED”, “user-agent”=>"Square-Ruby-SDK/20.1.0.20220616 (2022-06-16) ruby/3.1.2 (x86_64-darwin21) ", “Square-Version”=>“2022-06-16”}, @parameters={}, @context={}>
web | #<Square::HttpResponse:0x00000001129e2308 @status_code=415, @reason_phrase=“Unsupported Media Type”, @headers={“date”=>“Fri, 09 Dec 2022 22:07:17 GMT”, “content-type”=>“text/plain; charset=utf-8”, “transfer-encoding”=>“chunked”, “connection”=>“keep-alive”, “x-frame-options”=>“SAMEORIGIN”, “x-xss-protection”=>“1; mode=block”, “x-content-type-options”=>“nosniff”, “x-download-options”=>“noopen”, “x-permitted-cross-domain-policies”=>“none”, “referrer-policy”=>“strict-origin-when-cross-origin”, “vary”=>“Accept”, “cache-control”=>“no-cache”, “x-request-id”=>“27974331-f9e4-422c-b63f-daf1c523fbde”, “x-sq-dc”=>“sjc2b”, “x-sq-region”=>“sjc2b”, “strict-transport-security”=>“max-age=631152000; includeSubDomains; preload”}, @raw_body=“Unrecognized content-type="application/x-www-form-urlencoded", supported: application/x-protobuf, application/json\n”, @request=#<Square::HttpRequest:0x0000000112a03260 @http_method=“DELETE”, @query_url=“https://connect.squareupsandbox.com/v2/invoices/inv%3A0-ChCgRQlWdGNniXj8ZUq-Y-MQEOcI”, @headers={“accept”=>“application/json”, “Authorization”=>“Bearer REMOVED”, “user-agent”=>"Square-Ruby-SDK/20.1.0.20220616 (2022-06-16) ruby/3.1.2 (x86_64-darwin21) ", “Square-Version”=>“2022-06-16”}, @parameters={}, @context={}>>