-
-
Save phillipadsmith/cae2026965c2dcc513fe to your computer and use it in GitHub Desktop.
Value of $self->req->json is undef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
put '/source' => sub { | |
my $self = shift; | |
my $schema = $self->schema; | |
#my $json = $self->req->body; | |
say Dumper( $self->req->json ); | |
# $VAR1 = undef; | |
my $source; | |
#my $source = $schema->resultset( 'Source' )->create( $json ); | |
if ( $source ) { | |
$self->res->code( 200 ); | |
$self->render( json => { source_id => $source->id } ); | |
} | |
else { | |
$self->res->code( 422 ); | |
$self->render( json => { error => "Unable to create source." } ); | |
} | |
}; | |
# This is the PUT request | |
PUT /source.json HTTP/1.1 | |
Host: localhost:3000 | |
Content-Type: application/json | |
Cache-Control: no-cache | |
Postman-Token: e2a040fd-0a0d-7c0c-5759-ea4fc949c4fd | |
{ | |
'name': 'Test name', | |
'description': 'Test description', | |
'url': 'http://domain.com' | |
} | |
# Setup | |
CORE | |
Perl (v5.18.1, darwin) | |
Mojolicious (5.24, Tiger Face) | |
OPTIONAL | |
EV 4.0+ (not installed) | |
IO::Socket::IP 0.20+ (not installed) | |
IO::Socket::Socks 0.64+ (not installed) | |
IO::Socket::SSL 1.84+ (1.953) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment