Hi,
I have two functions:
get '/applications/:id' => sub {
my $self = shift;
my $id = $self->param('id') || "Not given";
$self->render(text => "id is: $id");
# $c->render(json => $resp);
};
put '/applications/:id' => sub {
my $self = shift;
my $id = $self->param('id') || "Not given";
$self->render(text => "you wanna update app id: $id\n");
# $c->render(json => $resp);
};
the get works just fine but the put gives a 404 which i've attached.
I'm pulling my hair out. I really don't understand why these identical
requests would have different outcomes.
Here's the curl request working correctly:
root@docker-host /work/SteelConnect/environment-templates/docker/topologies
(master) $ curl -X GET localhost/api/applications/12345
id is: 12345
here's it failing with a put request:
root@docker-host /work/SteelConnect/environment-templates/docker/topologies
(master) $ curl -X PUT localhost/api/applications/12345
<!DOCTYPE html>
<html>
<head><title>Page not found</title></head>
<style>
a img { border: 0 }
body { background-color: #caecf6 }
#noraptor {
left: 0%;
position: fixed;
top: 60%;
}
#notfound {
background: url(/mojo/notfound.png);
height: 62px;
left: 50%;
margin-left: -153px;
margin-top: -31px;
position:absolute;
top: 50%;
width: 306px;
}
</style>
<body>
<a href="http://localhost">
<img alt="Bye!" id="noraptor" src="/mojo/noraptor.png">
</a> <div id="notfound"></div>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
Thanks,
Josh
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Title: Page not found (development mode)
Page not found... yet!
None of these routes could generate a response for your
PUT request for
/api/applications/12345, maybe you need
to add a new one?
| Pattern |
Methods |
Name |
/api
|
*
|
api
|
+/applications
|
GET
|
applications
|
+/applications/:id
|
GET
|
applicationsid
|
+/applications
|
POST
|
applications
|
+/applications/:id
|
PUT
|
applicationsid
|
| Method: |
PUT |
| URL: |
/api/applications/12345 |
| Base URL: |
http://127.0.0.1:43761 |
| Parameters: |
{}
|
| Stash: |
{
"cb" => sub { "DUMMY" },
"id" => 12345
}
|
| Session: |
{}
|
| Version: |
1.1 |
| Accept-Encoding: |
gzip |
| Content-Length: |
17 |
| Host: |
127.0.0.1:43761 |
| User-Agent: |
Mojolicious (Perl) |
| Perl: |
v5.18.2 (linux) |
| Mojolicious: |
7.44 (Doughnut) |
| Home: |
/opt/appctrl/lib |
| Template paths: |
[
bless( do{\(my $o = "/opt/appctrl/lib/templates")}, 'Mojo::Home' )
]
|
| Template classes: |
[
"main"
]
|
| Static paths: |
[
bless( do{\(my $o = "/opt/appctrl/lib/public")}, 'Mojo::Home' )
]
|
| Static classes: |
[
"main"
]
|
| Include: |
[
"lib",
"/opt/appctrl/blib/lib",
"/etc/perl",
"/usr/local/lib/perl/5.18.2",
"/usr/local/share/perl/5.18.2",
"/usr/lib/perl5",
"/usr/share/perl5",
"/usr/lib/perl/5.18",
"/usr/share/perl/5.18",
"/usr/local/lib/site_perl",
"."
]
|
| Config: |
{}
|
| Moniker: |
api |
| Name: |
./api.pm |
| Executable: |
/usr/bin/perl |
| PID: |
96 |
| Time: |
Fri Sep 8 00:34:33 2017 |
tap for more
[Fri Sep 8 00:34:33 2017] [debug] PUT "/api/applications/12345"
|
[Fri Sep 8 00:34:33 2017] [debug] Routing to a callback
|
[Fri Sep 8 00:34:33 2017] [debug] Template "HASH(0x36abbc0).html.ep" not found
|
[Fri Sep 8 00:34:33 2017] [debug] Template "not_found.development.html.ep" not found
|
[Fri Sep 8 00:34:33 2017] [debug] Template "not_found.html.ep" not found
|
[Fri Sep 8 00:34:33 2017] [debug] Rendering template "mojo/debug.html.ep"
|
[Fri Sep 8 00:34:33 2017] [debug] Rendering template "mojo/menubar.html.ep"
|
[Fri Sep 8 00:34:33 2017] [debug] Your secret passphrase needs to be changed
|