Skip to content

Instantly share code, notes, and snippets.

@magnuspalmer
Created April 17, 2016 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magnuspalmer/52a9e16af89cda1a9ccd0a5b5bdc7edb to your computer and use it in GitHub Desktop.
Save magnuspalmer/52a9e16af89cda1a9ccd0a5b5bdc7edb to your computer and use it in GitHub Desktop.
RestAssured ContentLength
@Grapes([
@Grab('com.jayway.restassured:rest-assured:2.9.0'),
@GrabExclude(group = 'org.codehaus.groovy', module='groovy-all'),
@GrabExclude(group = 'org.codehaus.groovy', module='groovy-xml')
])
import static com.jayway.restassured.RestAssured.*
import static com.jayway.restassured.matcher.RestAssuredMatchers.*
import static org.hamcrest.Matchers.*
import static com.jayway.restassured.config.RestAssuredConfig.*
import com.jayway.restassured.RestAssured
import com.jayway.restassured.config.*
import com.jayway.restassured.config.RestAssuredConfig.*
RestAssured.baseURI = "http://jsonplaceholder.typicode.com"
given()
.log().all()
.param('userId', '1')
.header("User-Agent", "GroovyConsole")
.when()
.get("/posts")
.then()
.statusCode(200)
.log().all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment