Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bexley][Whitespace] Add endpoint for incoming notifications #4893

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package FixMyStreet::App::Controller::Waste::Whitespace;
use Moose;
use namespace::autoclean;

BEGIN { extends 'Catalyst::Controller' }

with 'FixMyStreet::Roles::Syslog';

use utf8;

has log_ident => (
is => 'ro',
default => sub {
my $feature = 'whitespace';
my $features = FixMyStreet->config('COBRAND_FEATURES');
return unless $features && ref $features eq 'HASH';
return unless $features->{$feature} && ref $features->{$feature} eq 'HASH';
my $f = $features->{$feature}->{_fallback};
return $f->{log_ident};
}
);

sub receive_whitespace_event_notification : Path('/waste/whitespace') : Args(0) {
my ($self, $c) = @_;

Check warning on line 24 in perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm#L24

Added line #L24 was not covered by tests

my %headers = $c->req->headers->flatten;
$self->log($c->req->method);
$self->log(\%headers);
$self->log($c->req->parameters);

Check warning on line 29 in perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm#L26-L29

Added lines #L26 - L29 were not covered by tests
if ($c->req->body) {
my $soap = join('', $c->req->body->getlines);
$self->log($soap);

Check warning on line 32 in perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm#L31-L32

Added lines #L31 - L32 were not covered by tests
} else {
$self->log('No body');

Check warning on line 34 in perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm#L34

Added line #L34 was not covered by tests
}

$c->response->status(200);
$c->response->body('OK');

Check warning on line 38 in perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/App/Controller/Waste/Whitespace.pm#L37-L38

Added lines #L37 - L38 were not covered by tests
}

1;
Loading