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

How to do a PUT/POST with content type as text/plain? #18

Open
sandeepnagra opened this issue Jun 30, 2017 · 2 comments
Open

How to do a PUT/POST with content type as text/plain? #18

sandeepnagra opened this issue Jun 30, 2017 · 2 comments

Comments

@sandeepnagra
Copy link

sandeepnagra commented Jun 30, 2017

I tried something like:

Scenario: Try to set keep data value under database settings with response code 200
Given I send "text/plain" and accept JSON
When I send a PUT request to "http://hostname:8080/settings/databaseSettings/dataRetention" with:
| 90 |
Then the response status should be "200"

But it fails. I have always used JSON request body, this is the first REST API which needs plain text and I am trying to figure out how to do it.

@sandeepnagra
Copy link
Author

sandeepnagra commented Jun 30, 2017

Temporarily, I have created following custom step:

When(/^I set request body to "(.*?)"$/) do |value|
@Body = value
end

and then the following scenario works:

Scenario: Try to set keep data value under database settings with response code 200
Given I send "text/plain" and accept JSON
And I set request body to "90"
When I send a PUT request to "http://hostname:8080/settings/databaseSettings/dataRetention"
Then the response status should be "200"

@hidroh
Copy link
Owner

hidroh commented Jul 2, 2017

That would be my approach for this as well. Make a PR, probably adding a sample and I'll merge it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants