<commit_before>package uk.gov.gds.router.controller

import org.scalatra.ScalatraFilter
import javax.servlet.http.Cookie
import scala.collection.JavaConversions._

class TestHarnessController extends ScalatraFilter {

  before() {
    response.setContentType("text/html")
  }

  get("/test/test-harness") {
    output(dumpParams)
  }

  get("/someprefix/unregistered") {
    output("unregistered")
  }

  get("/someprefix") {
    output("prefix route")
  }

  get("/test/test-harness/") {
    output(dumpParams)
  }

  post("/test/test-harness") {
    output(dumpParams)
  }

  get("/foo") {
    output("fooOnly")
  }

  get("/foo/*") {
    output("fooOnly")
  }

  get("/test/timeout") {
    Thread.sleep(20000)
  }

  get("/football") {
    output("football")
  }

  get("/test/redirect") {
    redirect("http://www.alphagov.co.uk")
  }

  post("/test/redirect") {
    redirect("http://www.alphagov.co.uk")
  }

  get("/test/this-route-returns-an-error") {
    halt(500)
  }

  get("/test/410") {
    halt(410)
  }
  
  get("/test/incoming-headers") {
    output(dumpHeaders)
  }

  get("/test/incoming-cookies") {
    output(dumpCookies)
  }

  get("/test/set-header") {
    response.addHeader("X-Test", "test")
  }

  get("/test/set-rack-cache-header") {
    response.addHeader("X-Rack-Cache", "test")
  }

  get("/test/outgoing-cookies") {
    response.addCookie(new Cookie("test-cookie", "this is a cookie"))
  }

  get("/test/not-modified") {
    halt(304)
  }

  post("/test/not-modified") {
    halt(304)
  }

  get("/test/runtime-exception") {
    throw new RuntimeException("exception")<commit_msg>Stopped large stactrace during timeout tests<commit_after>package uk.gov.gds.router.controller

import org.scalatra.ScalatraFilter
import javax.servlet.http.Cookie
import scala.collection.JavaConversions._

class TestHarnessController extends ScalatraFilter {

  before() {
    response.setContentType("text/html")
  }

  get("/test/test-harness") {
    output(dumpParams)
  }

  get("/someprefix/unregistered") {
    output("unregistered")
  }

  get("/someprefix") {
    output("prefix route")
  }

  get("/test/test-harness/") {
    output(dumpParams)
  }

  post("/test/test-harness") {
    output(dumpParams)
  }

  get("/foo") {
    output("fooOnly")
  }

  get("/foo/*") {
    output("fooOnly")
  }

  get("/test/timeout") {
    try {
      Thread.sleep(20000)
    }
    catch {
      case e: InterruptedException => // no-op
    }
  }

  get("/football") {
    output("football")
  }

  get("/test/redirect") {
    redirect("http://www.alphagov.co.uk")
  }

  post("/test/redirect") {
    redirect("http://www.alphagov.co.uk")
  }

  get("/test/this-route-returns-an-error") {
    halt(500)
  }

  get("/test/410") {
    halt(410)
  }

  get("/test/incoming-headers") {
    output(dumpHeaders)
  }

  get("/test/incoming-cookies") {
    output(dumpCookies)
  }

  get("/test/set-header") {
    response.addHeader("X-Test", "test")
  }

  get("/test/set-rack-cache-header") {
    response.addHeader("X-Rack-Cache", "test")
  }

  get("/test/outgoing-cookies") {
    response.addCookie(new Cookie("test-cookie", "this is a cookie"))
  }

  get("/test/not-modified") {
    halt(304)
  }

  post("/test/not-modified") {
    halt(304)
  }

  get("/test/runtime-exception") {
    throw new RuntimeException("exception")
{'fraction_non_alphanumeric': 0.18558558558558558, 'fraction_numerical': 0.012012012012012012, 'mean_word_length': 2.970202622169249, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '424172', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1167, 'n_words': 142}