Make Selenium Easy

REST Assured Tutorial 18 – Querying RequestSpecification in Rest Assured

As a part of End to End REST Assured Tutorial , in this post We will learn about “Querying RequestSpecification in Rest Assured”.

We know that RequestSpecification is used to create a request or how the request will look like. We set base URI, base path, headers, etc to request using RequestSpecification. There is a way available to query this RequestSpecification as well so that at any point of time we can retrieve details of RequestSpecification like what is base URI is set etc.

To query or retrieve details from RequestSpecification, Rest Assured provides a class named SpecificationQuerier. This class has a static method called query(RequestSpecification specification) which returns reference of QueryableRequestSpecification interface. This interface has methods to retrieve request details such as getBasePath(), getBody() etc.

Rest Assured Program:-


You can clone/download example repo here.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.

You can find all Selenium related post here.
You can find all API manual and automation related posts here.
You can find frequently asked Java Programs here.

Author: Amod Mahajan

A software Tester who is paid to judge products developed by others. Currently getting paid in American Dollars. Writing technical posts and creating YouTube videos are my hobbies.

4 thoughts on “REST Assured Tutorial 18 – Querying RequestSpecification in Rest Assured

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.