Comments (3)
Can someone please look into it?
from restassured.net.
I have the same problem, I need the response body to perform validations with the database.
I'm working on a big project and this is essential for validations.
Thanks.
from restassured.net.
The lack of strongly typed Retrieve can be gotten around with something like JSON.net to serialize/deserialize to your desired type. I use an extension method like the following to wrap this functionality:
public static T RetrieveBody<T>(this ResponseContext context)
{
var json = (string)context.Retrieve(x => JsonConvert.SerializeObject(x));
return JsonConvert.DeserializeObject<T>(json);
}
Which then allows you to use it like this:
var response = new RestAssured()
.Given()
.Name("JsonIP Test Suite")
.Header("Content-Type", "application/json")
.Header("Accept-Encoding", "gzip,deflate")
.When()
.Get("http://jsonip.com")
.Then()
.RetrieveBody<Dictionary<string,string>>();
Assert.Equal(response["ip"], "2605:6000:f705:ab00:78e3:1959:78d4:bd76");
where Dictionary<string, string>
is whatever type you want to convert the response to.
from restassured.net.
Related Issues (20)
- Schema Check failed while using AssertAll() HOT 1
- Need step by step to access REST
- Questions about RestAssured.Net HOT 5
- Is there a way to set cookies in get/post calls?
- AssertAll validates response schema even when not requested for .
- File with ContentDispositionHeaderValue "form-data" instead of "attachment"
- Test method threw Exception: (text/plain) not supported HOT 3
- Could you make version compiled under v4.5 .Net standard
- Breaking up a call chain example is obselete in README file HOT 1
- Implement support for multiple Query params with same name HOT 1
- Not able to install packages with .NetFramework 4.5.1 or 4.5.2 HOT 2
- RestAssured.Net with Specflow
- Cant hit localhost
- Ignore certificate erros
- Auth
- .Body() only serialises to json objects and doesn't support other types such as binary files
- What is the namespace for import
- Failed to parse "2.3.3" json response
- Only limited response-types work? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restassured.net.