def r as request(GET)

def date as datetime

def res as response(
  r.path("https://httpbingo.org/anything")
   .query_string(tuple("search", "def language"))
   .query_string(tuple("page", "1"))
   .query_string(tuple("date", date.format("dd/mm/yyyy")))
   .do()
)

def search as string("def language")
print("status:        {{res.status()}}")
print("ok:            {{res.ok()}}")
print("duration:      {{res.duration()}}ms")
print("size:          {{res.size()}} bytes")
print("content-type:  {{res.content_type()}}")
print("body contains '{{search}}': {{res.body_contains(search)}}")
print("body:          {{res.body()}}")

def res_from_file as response(
  def search_term as string("def language")

  request(GET)
    .path("https://httpbingo.org/anything")
    .query_string_from("qdef/query-string.qdef")
    .with_var(search_term)
    .query_string(tuple("page", "2"))
    .do()
)

def search as string("abc")
print("status:        {{res_from_file.status()}}")
print("ok:            {{res_from_file.ok()}}")
print("duration:      {{res_from_file.duration()}}ms")
print("size:          {{res_from_file.size()}} bytes")
print("content-type:  {{res_from_file.content_type()}}")
print("body contains '{{search}}': {{res_from_file.body_contains(search)}}")
print("body:          {{res_from_file.body()}}")
