Bug in Content Type assignments - form encoded adding charset

goofy78270goofy78270 Posts: 32

I found a potential bug, or room for improvement...

When setting up a Request in SoaTest, and setting the payload to URL Encoded (application/x-www-form-urlencoded), the resulting header is:
Content-Type: application/x-www-form-urlencoded; **charset=UTF-8
**
If the charset is going to be added to the content type, can it be shown in the dropdown as a possible option, along with an option that does not include it?

I have manually overrode the Content-Type to be only application/x-www-form-urlencoded, in the HTTP Headers section, but the time spent trying to determine the reason for a failure was not obvious as my selection matched the desired request option. I am posting this to hopefully help others who may run into the same issue, until a fix/enhancement can be implemented.

Comments

  • benken_parasoftbenken_parasoft Posts: 745 ✭✭✭

    The character encoding for the request payload affects multiple things one of which is the "charset" parameter in the Content-Type http header. Since it affects mutliple things the character encoding has always had its own dedicated configuration option. In the REST Client the character encoding is configured on the Misc Tab.

    Concerning the "application/x-www-form-urlencoded" media type, it seems debatable whether the "charset" parameter should be present or not. It probably depends on whether the particular service API expects it or not. As you discovered, any auto generated HTTP headers can be overridden as needed on the HTTP Options tab.

  • goofy78270goofy78270 Posts: 32

    thank you for pointing this setting out under the Misc tab, there is no option to exclude an encoding type, so a custom header value appear to be the only way to do this, unless a none or empty option can be added to the list.

  • benken_parasoftbenken_parasoft Posts: 745 ✭✭✭
    edited July 11

    I have a little more information. The "Content-Type" header is generated automatically based on other tool configuration settings. The "charset" parameter is not always included but is included conditionally depending on whether the media type is determined to be text or not.

    So, to exclude the "charset" parameter there are two options. One is to override the "Content-Type" header completely by adding the replacement in the HTTP options. The other is to tell SOAtest to treat the media type as binary in the Parasoft Preferences under MIME Types where you would uncheck "Text" for "application/x-www-form-urlencoded". I haven't tried this second option but this is generally the place where you configure media types and tell SOAtest which ones are text (as opposed to binary).

  • goofy78270goofy78270 Posts: 32

    Thank you for the follow up. I will work these into future tests as needed.

Sign In or Register to comment.