Skip to main content
steva_123
Participant
December 11, 2017
Answered

Request method

  • December 11, 2017
  • 1 reply
  • 454 views

I am trying to get the 'request method' (POST, PUT, GET), but somehow it doesn't work.

On localhost I do get the request method used back correctly, only on our server it always returns 'GET'.

When I put the code on the server in a different folder I do get the method back.

What should I be looking for that might overrule or change the 'request method'?

Tested with: GetHttpRequestData().method and cgi.REQUEST_METHOD

Using: Postman

On ColdFusion: 11

Background: working with CF11 but without CF11 devs. trying to maintain code from my PHP experience.

Any help would be greatly appreciated, thanks!

    This topic has been closed for replies.
    Correct answer Dave Watts

    The HTTP verb you send with your request will control the request method. This is entirely controlled by the browser. Usually, it's going to be "GET", but if you fill out a form with METHOD="POST", it'll be "POST". In Postman, you can control the HTTP verb you use.

    If you're already doing that, and are still seeing "GET", there's probably some HTTP redirect happening between the request you send and the response you're looking at.

    Dave Watts, CTO, Fig Leaf Software

    1 reply

    Dave WattsCommunity ExpertCorrect answer
    Community Expert
    December 11, 2017

    The HTTP verb you send with your request will control the request method. This is entirely controlled by the browser. Usually, it's going to be "GET", but if you fill out a form with METHOD="POST", it'll be "POST". In Postman, you can control the HTTP verb you use.

    If you're already doing that, and are still seeing "GET", there's probably some HTTP redirect happening between the request you send and the response you're looking at.

    Dave Watts, CTO, Fig Leaf Software

    Dave Watts, Eidolon LLC
    Charlie Arehart
    Community Expert
    Community Expert
    December 11, 2017

    Yep, since you say it acts differently in a differently folder, I wondered if your application.cfc or cfm of the request in question might have in it some code doing a CFLOCATION or other form of redirect, that was causing the request method to change to a get.

    Or you may look to see if your web server (IIS or Apache) has any sort of URL Rewrite processing going on, as that too would lose the original request method.

    /charlie

    /Charlie (troubleshooter, carehart. org)