Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #895 from joyent/ether/v2-response-header-version
Browse files Browse the repository at this point in the history
add a X-Conch-API header to every response
  • Loading branch information
karenetheridge authored Sep 26, 2019
2 parents 112c428 + 26f03da commit 572409e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/Conch.pm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ sub startup {
}
);

$self->hook(after_render => sub ($c, @args) {
$c->tx->res->headers->add('X-Conch-API', $c->version_tag);
});

$self->helper(
status => sub ($c, $code, $payload = undef) {
Expand Down
3 changes: 2 additions & 1 deletion t/integration/crud/unsecured-endpoints.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ $t->load_fixture('legacy_datacenter');

$t->get_ok('/ping')
->status_is(200)
->json_is({ status => 'ok' });
->json_is({ status => 'ok' })
->header_is('X-Conch-API', $t->app->version_tag);

$t->get_ok('/version')
->status_is(200)
Expand Down

0 comments on commit 572409e

Please sign in to comment.