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

Enable passing in custom JsonSerializerSettings when (de-)serializing to/from JSON #84

Closed
basdijkstra opened this issue Jun 5, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@basdijkstra
Copy link
Owner

Right now the default settings are used but I can think of plenty of use cases where custom settings might be useful.

Pass in as an overload to Body() for the request and DeserializeTo() and As() for the response.

@basdijkstra basdijkstra added the enhancement New feature or request label Jun 5, 2023
@basdijkstra basdijkstra self-assigned this Jun 5, 2023
@basdijkstra
Copy link
Owner Author

To test this: create a new test where a request payload containing a date is serialized, use a custom JsonSerializerSettings object with a different value for the DateFormatString property and check that the date is formatted properly in the WireMock stub.

@basdijkstra
Copy link
Owner Author

Support for supplying custom JsonSerializerSettings when supplying request body using Body() added in 7db6ca7

Still to do: the same for deserialization, but I need to have a good look at how to create the right overloads.

@basdijkstra basdijkstra added the in progress This issue is currently being worked on label Jun 9, 2023
@basdijkstra
Copy link
Owner Author

On second thought: maybe it’s better to pass in these settings in a method of their own rather than using overloads.

Also need to add support for configuring these through RequestSpecification and RestAssuredConfig.

@basdijkstra
Copy link
Owner Author

6404657 adds the capability to set custom JsonSerializerSettings for individual tests as well as in a RequestSpecification.

To do: specify custom JsonSerializerSettings to be used when deserializing JSON response payloads.

@basdijkstra basdijkstra removed the in progress This issue is currently being worked on label Jun 19, 2023
@basdijkstra
Copy link
Owner Author

Added the ability to supply custom JSON deserialization settings using UsingJsonSerializerSettings() when deserializing response bodies from JSON in 2f9c866

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

No branches or pull requests

1 participant