Hi, Thanks for responding! I actually got the html by running the command that you mentioned, so that's what makes me think it might be some kind of weird bug, rather than just my own lack of understanding.
That is, to answer your question, the two commands produce the exact same problem as the curl request. The HTML that is attached is the output of running the "api.pm get -M PUT /api/applications" as you suggested (i had run it like that prior to your suggestion and got that output). I'm actually using "under '/api' as well, so that's why the commands are calling /api/applications/:id. On Thursday, September 7, 2017 at 7:04:42 PM UTC-7, Stefan Adams wrote: > > What does the output of the `routes' command for your app show? > > What does `my_app.pl get -M GET /applications/12345' show versus ` > my_app.pl get -M PUT /applications/12345'? Notice we're testing the > routes using the app directly. > > Your routes are /applications/:id, but your curl requests are to > /api/applications/:id. Could it have anything to do with what must sit in > front of your app? > > On Thu, Sep 7, 2017 at 8:23 PM, jcast89 <[email protected] <javascript:>> > wrote: > >> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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.
