Skip to content

Instantly share code, notes, and snippets.

@schatteleyn
Created April 19, 2013 13:31
Show Gist options
  • Save schatteleyn/5420371 to your computer and use it in GitHub Desktop.
Save schatteleyn/5420371 to your computer and use it in GitHub Desktop.
val headers_13 = Map(
"Accept" -> """*/*""",
"Origin" -> """http://site.com""",
"token" -> """token"""
)
val scn = scenario("Scenario Name")
.exec(http("request_1")
.post("http://site.com/login")
.headers(headers_1)
.param("""player[email]""", """email@address.com""")
.param("""player[password]""", """password""")
)
.pause(757 milliseconds)
/* more .exec */
.exec(http("request_13")
.get("http://site.com/logout")
.headers(headers_13)
)
.pause(202 milliseconds)
@slandelle
Copy link

val headers_13 = Map(
    "Accept" -> """*/*""",
    "Origin" -> """http://site.com""")

val scn = scenario("Scenario Name")
    .exec(http("request_1")
        .post("http://site.com/login")
        .headers(headers_1)
        .param("""player[email]""", """email@address.com""")
        .param("""player[password]""", """password""")
        .check(header("token").saveAs("token")))
    .pause(757 milliseconds)

    /* more .exec */

    .exec(http("request_13")
        .get("http://site.com/logout")
        .headers(headers_13)
        .header("token", "${token}"))
    .pause(202 milliseconds)

@schatteleyn
Copy link
Author

Thanks a lot ! It compiles. Well it does not find the token, but it is at least compiling.

@maxgarvey
Copy link

this is excellent! a dynamic header example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment