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

Commit

Permalink
add a X-Conch-API header to every response
Browse files Browse the repository at this point in the history
This way, clients can check the version even when their client is not
compatible with the api.
  • Loading branch information
karenetheridge committed Sep 26, 2019
1 parent 112c428 commit 26f03da
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 26f03da

Please sign in to comment.