Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test a plain text response content #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bystro
Copy link
Contributor

@bystro bystro commented Sep 17, 2018

  • Testing if a plain text value of response content is desirable
  • Testing if a plain text value of response content is empty

@bystro bystro closed this Sep 17, 2018
@bystro bystro reopened this Sep 17, 2018
@bystro bystro closed this Sep 17, 2018
@bystro bystro reopened this Sep 17, 2018
@tyx
Copy link
Member

tyx commented Sep 17, 2018

Hello @bystro !

I'm not sure to get the issue. You want to test plain text response ? What is the use case ?

I am not convinced of the interest of adding it to the project.
It is over generic and not and in general you want to make specific test for your scenario.

As you did, you can easily do it at your application level, so may be it is enough ?

@bystro bystro closed this Sep 17, 2018
@bystro bystro reopened this Sep 17, 2018
@bystro bystro closed this Sep 18, 2018
@bystro bystro reopened this Sep 18, 2018
@bystro
Copy link
Contributor Author

bystro commented Sep 18, 2018

@tyx Ajax's XMLHttpRequest has it in response and responseText property:
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/response
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseText

If you return only one value(for example generated UUID) it is convenient to return it responseText as plain text string instead of json with only one property.

https://www.google.com/search?client=firefox-b&biw=1920&bih=966&ei=weygW_2_FcOzkwXNt5G4Cg&q=how+to+get+response+text+in+ajax&oq=how+to+get+response+text+in+ajax&gs_l=psy-ab.3..0i10i30k1l2.15754.15754.0.15965.1.1.0.0.0.0.130.130.0j1.1.0....0...1c.1.64.psy-ab..0.1.128....0.z5CzilbS8wE

We can think about better communication the issue maybe?

@tyx
Copy link
Member

tyx commented Sep 19, 2018

Thanks for the details !

At the origin, we wanted to have an extension to help us to test rest api. So XMLHttpRequest stuff was not in the initial scope, and I'm sure other extension make this job no?

But if many people use this one to other stuff that testing rest api, we can consider to extend the initial scope may be. Need to think about it.

@bystro
Copy link
Contributor Author

bystro commented Sep 24, 2018

Regarding to XMLHttpRequest it was only an example.
There are more
https://futurestud.io/tutorials/retrofit-2-receive-plain-string-responses
https://angular.io/guide/http
image

My example use case is the following.
When I send request to create new resource I'm waiting for 201 Created in response header and get new resource id as a plain text value from response content - no need to play with json format.

@bystro bystro closed this Sep 25, 2018
@bystro bystro reopened this Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants