Bug 64374 - Not Able to Capture Response when there is no Content-Type header
Summary: Not Able to Capture Response when there is no Content-Type header
Status: NEEDINFO
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 5.2.1
Hardware: PC All
: P2 minor (vote)
Target Milestone: JMETER_5.3.0
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-24 01:31 UTC by Matias Fornara
Modified: 2020-04-27 19:18 UTC (History)
1 user (show)



Attachments
xml from Simple Data Write (2.48 KB, text/xml)
2020-04-24 01:31 UTC, Matias Fornara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matias Fornara 2020-04-24 01:31:59 UTC
Created attachment 37196 [details]
xml from Simple Data Write

I am testing a Desktop Application that in certain responses does not send a Content-Type header (that is the app default behavior and cannot be modified). 

This behavior makes that JMeter sets that attribute as an empty string in the sampler result so when it tries to write the response body it fails with the following message: "Non-TEXT response data, cannot record: ()".

Apart from that missing header, I can notice that server is responding with some message because the Content-Length is 101, but I cannot see the actual response because of this behavior.

The thing is, I understand this is JMeter's expected behavior in these cases but from a testing perspective, it would be useful that JMeter does not lose the response even when it is not a String, maybe it can be at least logged in the JMeter log or specified in the sampler result somehow.
Comment 1 Philippe Mouawad 2020-04-25 13:19:10 UTC
You can workaround this by using a JSR223 Post Processor that can set the content type to a text one.

As you wrote it, empty content type does not look correct so I don't think we should fix this.
Comment 2 Matias Fornara 2020-04-27 19:04:52 UTC
(In reply to Philippe Mouawad from comment #1)
> You can workaround this by using a JSR223 Post Processor that can set the
> content type to a text one.
> 
> As you wrote it, empty content type does not look correct so I don't think
> we should fix this.

Thanks for the workaround, I will definitely use it.

I understand what you say but there are two other things here, one is that JMeter is doing nothing to defend itself from these kinds of situations.

And the other is that the assertion over that response is being applied as it was a text response but then it is not able to record it, it is not a consistent behavior.

Thanks for the quick response.
Comment 3 Philippe Mouawad 2020-04-27 19:18:54 UTC
(In reply to Matias Fornara from comment #2)
> (In reply to Philippe Mouawad from comment #1)
> > You can workaround this by using a JSR223 Post Processor that can set the
> > content type to a text one.
> > 
> > As you wrote it, empty content type does not look correct so I don't think
> > we should fix this.
> 
> Thanks for the workaround, I will definitely use it.
> 
> I understand what you say but there are two other things here, one is that
> JMeter is doing nothing to defend itself from these kinds of situations.

Such situation is abnormal according to RFC.
How are we supposed whether content is binary or text without content-type ?


> 
> And the other is that the assertion over that response is being applied as
> it was a text response but then it is not able to record it, it is not a
> consistent behavior.


The behaviour is that if it's binary we don't save it to XML
> 
> Thanks for the quick response.