[Node/Express vs Play] Request 'request_name' failed: status.find.is(200), but actually found 304 with express js

Hello

I’m making some tests with expressjs (v4) end playframework (v2), it’s just a get request, this is the expressjs code (very simple)

var express = require('express')
  , bodyParser = require('body-parser')
  , app = express()
  , http_port = 9000

app.use(express.static(__dirname + '/public'));
app.use(bodyParser.json());

app.get("/humans", function(req, res) {
  res.status(200).send([1,2,3,4,5,6]);
})

app.listen(http_port);
console.log("Listening on " + http_port);

I’ve the same service with play, on the same computer

I launch gatling with this code (on the same computer):

class BasicSimulationGetAll extends Simulation {
  val httpConf = http
    .baseURL("http://localhost:9000")

  val scn = scenario("Get All Humans").repeat(100) {
    exec(
      http("get humans")
        .get("/humans")
        .check(status.is(200))
    )
  }

  setUp(scn
    .inject(rampUsers(50) over (60)).protocols(httpConf))
}

All is ok with Play

And with express, almost all requests are ko (nothing wrong express side (no error), it’s ok with postman) , this is an extract of the logs:

05:39:50.192 [GatlingSystem-akka.actor.default-dispatcher-7][WARN ][AsyncHandlerActor.scala:127] i.g.h.a.AsyncHandlerActor - Request ‘get humans’ failed: status.find.is(200), but actually found 304
05:39:50.193 [GatlingSystem-akka.actor.default-dispatcher-5][WARN ][AsyncHandlerActor.scala:127] i.g.h.a.AsyncHandlerActor - Request ‘get humans’ failed: status.find.is(200), but actually found 304
05:39:50.196 [GatlingSystem-akka.actor.default-dispatcher-7][WARN ][AsyncHandlerActor.scala:127] i.g.h.a.AsyncHandlerActor - Request ‘get humans’ failed: status.find.is(200), but actually found 304
05:39:50.198 [GatlingSystem-akka.actor.default-dispatcher-7][WARN ][AsyncHandlerActor.scala:127] i.g.h.a.AsyncHandlerActor - Request ‘get humans’ failed: status.find.is(200), but actually found 304
05:39:50.199 [GatlingSystem-akka.actor.default-dispatcher-7][WARN ][AsyncHandlerActor.scala:127] i.g.h.a.AsyncHandlerActor - Request ‘get humans’ failed: status.find.is(200), but actually found 304
05:39:50.200 [GatlingSystem-akka.actor.default-dispatcher-7][WARN ][AsyncHandlerActor.scala:127] i.g.h.a.AsyncHandlerActor - Request ‘get humans’ failed: status.find.is(200), but actually found 304
05:39:50.202 [GatlingSystem-akka.actor.default-dispatcher-9][WARN ][AsyncHandlerActor.scala:127] i.g.h.a.AsyncHandlerActor - Request ‘get humans’ failed: status.find.is(200), but actually found 304
05:39:50.203 [GatlingSystem-akka.actor.default-dispatcher-5][WARN ][AsyncHandlerActor.scala:127] i.g.h.a.AsyncHandlerActor - Request ‘get humans’ failed: status.find.is(200), but actually found 304

Obviously, modification headers (Last-Modified or ETag) are enabled on the Express side while they aren’t on the Play one.

ok, I’m going to investigate with this, thank you very much (I’ll post when I found the solution)

ah \o/ you’re great!
I’ve just to add app.disable(‘etag’);
and now it’s ok
I’ve to learn a lot of things
thank you very much

Hi Dear All,
I having somewhat similar issue, I am trying to test my vaadin project, but the gatling shows "Request failed: status find is 304 but actually found 200.

Can you please help me.

val httpProtocol = http
    .baseURL("http://192.168.5.51:8080")
    .inferHtmlResources()

val headers_0 = Map("Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")

val headers_2 = Map("Accept" -> "*/*")

val headers_11 = Map("Accept" -> "image/png,image/*;q=0.8,*/*;q=0.5")

val headers_13 = Map(
    "Accept" -> "application/font-woff2;q=1.0,application/font-woff;q=0.9,*/*;q=0.8",
    "Accept-Encoding" -> "identity")

val uri1 = "http://192.168.5.51:8080/ActivityMonitor"

val scn = scenario("ActivityMonitor")
    // Search Url
    .exec(http("request_0")
        .get("/ActivityMonitor/")
        .headers(headers_0)
        .resources(http("request_1")
        .get(uri1 + "/VAADIN/themes/activitymonitor/styles.css?v=7.6.5")
        .check(status.is(304)),
        http("request_2")
        .get(uri1 + "/VAADIN/widgetsets/activitymonitorWidgetset/activitymonitorWidgetset.nocache.js?1463463908372")
        .headers(headers_2),
        http("request_3")
        .get(uri1 + "/VAADIN/themes/activitymonitor/imports.css")
        .check(status.is(304)),
        http("request_4")
        .get(uri1 + "/VAADIN/widgetsets/activitymonitorWidgetset/grid-util.css?v=1.0.8a")
        .check(status.is(304)),
        http("request_5")
        .get(uri1 + "/VAADIN/themes/activitymonitor/grid.css")
        .check(status.is(304)),
        http("request_6")
        .get(uri1 + "/VAADIN/themes/activitymonitor/menu.css")
        .check(status.is(304)),
        http("request_7")
        .get(uri1 + "/VAADIN/themes/activitymonitor/modules/myactivity-grid.css")
        .check(status.is(304)),
        http("request_8")
        .get(uri1 + "/VAADIN/themes/activitymonitor/dashboard.css"),
        http("request_9")
        .get(uri1 + "/VAADIN/themes/activitymonitor/modules/project-grid.css")
        .check(status.is(304)),
        http("request_10")
        .get(uri1 + "/VAADIN/widgetsets/activitymonitorWidgetset/FAB8FF54E62ED80710F53EB2E2C2434A.cache.js")
        .headers(headers_2)
        .check(status.is(304)),
        http("request_11")
        .get(uri1 + "/VAADIN/themes/valo/shared/img/spinner.gif")
        .headers(headers_11)
        .check(status.is(304)),
        http("request_12")
        .post(uri1 + "/?v-1463463908374")
        .headers(headers_0)
        .formParam("v-browserDetails", "1")
        .formParam("theme", "activitymonitor")
        .formParam("v-appId", "ActivityMonitor-765090603")
        .formParam("v-sh", "768")
        .formParam("v-sw", "1366")
        .formParam("v-cw", "1366")
        .formParam("v-ch", "697")
        .formParam("v-curdate", "1463463908374")
        .formParam("v-tzo", "-330")
        .formParam("v-dstd", "0")
        .formParam("v-rtzo", "-330")
        .formParam("v-dston", "false")
        .formParam("v-vw", "1366")
        .formParam("v-vh", "0")
        .formParam("v-loc", "http://192.168.5.51:8080/ActivityMonitor/")
        .formParam("v-wn", "ActivityMonitor-765090603-0.6916003790375647"),
        http("request_13")
        .get(uri1 + "/VAADIN/themes/base/fonts/fontawesome-webfont.woff")
        .headers(headers_13)
        .check(status.is(304))))
    .pause(12)
    // Login
    .exec(http("request_14")
        .post("/ActivityMonitor/UIDL/?v-uiId=0")
        .headers(headers_0)
        .body(RawFileBody("ActivityMonitor_0014_request.txt"))
        .resources(http("request_15")
        .get(uri1 + "/VAADIN/themes/base/fonts/themeicons-webfont.woff")
        .headers(headers_13)
        .check(status.is(304))))
    .pause(9)
    // Logout
    .exec(http("request_16")
        .post("/ActivityMonitor/UIDL/?v-uiId=0")
        .headers(headers_0)
        .body(RawFileBody("ActivityMonitor_0016_request.txt"))
        .resources(http("request_17")
        .get(uri1 + "/")
        .headers(headers_0),
        http("request_18")
        .post(uri1 + "/?v-1463463934756")
        .headers(headers_0)
        .formParam("v-browserDetails", "1")
        .formParam("theme", "activitymonitor")
        .formParam("v-appId", "ActivityMonitor-765090603")
        .formParam("v-sh", "768")
        .formParam("v-sw", "1366")
        .formParam("v-cw", "1366")
        .formParam("v-ch", "697")
        .formParam("v-curdate", "1463463934756")
        .formParam("v-tzo", "-330")
        .formParam("v-dstd", "0")
        .formParam("v-rtzo", "-330")
        .formParam("v-dston", "false")
        .formParam("v-vw", "1366")
        .formParam("v-vh", "0")
        .formParam("v-loc", "http://192.168.5.51:8080/ActivityMonitor/")
        .formParam("v-wn", "ActivityMonitor-765090603-0.6916003790375647"),
        http("request_19")
        .get(uri1 + "/VAADIN/widgetsets/activitymonitorWidgetset/activitymonitorWidgetset.nocache.js?1463463934755")
        .headers(headers_2),
        http("request_20")
        .get(uri1 + "/VAADIN/themes/activitymonitor/styles.css?v=7.6.5"),
        http("request_21")
        .get(uri1 + "/VAADIN/themes/activitymonitor/imports.css"),
        http("request_22")
        .get(uri1 + "/VAADIN/themes/activitymonitor/menu.css"),
        http("request_23")
        .get(uri1 + "/VAADIN/themes/activitymonitor/grid.css"),
        http("request_24")
        .get(uri1 + "/VAADIN/themes/activitymonitor/modules/project-grid.css"),
        http("request_25")
        .get(uri1 + "/VAADIN/themes/activitymonitor/modules/myactivity-grid.css"),
        http("request_26")
        .get(uri1 + "/VAADIN/widgetsets/activitymonitorWidgetset/FAB8FF54E62ED80710F53EB2E2C2434A.cache.js")
        .headers(headers_2)))

setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)

}