Skip to content

Error "unexpected status code" not reported when error "response does not match regex" occur #16

Description

@dentarg

Command line example:

$ httpunit https://www.google.com/foo 216.58.209.132 200 asdf
1 of 1 done in 199.789431ms
==== https://www.google.com/foo: https://www.google.com/foo IP=216.58.209.132 (200 R)
ERROR: response does not match regex [asdf]: "<!DOCTYPE html>\n<html lang=en>\n  <meta charset=utf-8>\n  <meta name=viewport content=\"initial-scale=1, minimum-scale=1, width=device-width\">\n  <title>Error 404 (Not Found)!!1</title>\n  <style>\n    *{margin:0;padding:0}html,code{font:15px/22px arial,sa"

TOML file example:

$ cat google.toml
[[plan]]
  code    = 200
  regex   = "asdf"
  label   = "google"
  url     = "https://www.google.com/foo"
$ httpunit -toml google.toml
==== google: https://www.google.com/foo DNS=216.58.209.132 (200 R)
ERROR: response does not match regex [asdf]: "<!DOCTYPE html>\n<html lang=en>\n  <meta charset=utf-8>\n  <meta name=viewport content=\"initial-scale=1, minimum-scale=1, width=device-width\">\n  <title>Error 404 (Not Found)!!1</title>\n  <style>\n    *{margin:0;padding:0}html,code{font:15px/22px arial,sa"
==== google: https://www.google.com/foo DNS=2a00:1450:400f:804::2004 (200 R)
ERROR: dial tcp [2a00:1450:400f:804::2004]:443: connect: no route to host

"unexpected status code" error is reported when there's no regex check:

$ httpunit https://www.google.com/foo
2 of 2 done in 197.267064ms
==== https://www.google.com/foo: https://www.google.com/foo DNS=216.58.209.132 (200)
ERROR: unexpected status code: 404
==== https://www.google.com/foo: https://www.google.com/foo DNS=2a00:1450:400f:804::2004 (200)
ERROR: dial tcp [2a00:1450:400f:804::2004]:443: connect: no route to host

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions