Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Grelav's avatar

POST Request Becomes GET In Lumen When Sending \n

Hello guys, am using Lumen 6.3.3

when am sending a POST request with JSON data using axios that contains \n the request becomes GET at the backend.

Firefox Browser Network Request Data shows:

-----------------------------109489214315235477653070397970 Content-Disposition: form-data; name="record" {"Name":"Free Hosting","Description":"Free Hosting Features\nEverything you could possibly need for your website.\n\n Unlimited Disk Space\n Unlimited Bandwidth\n 400 MySQL Databases\n\n PHP 5.4, 5.5, 5.6, 7.4\n MySQL 5.6\n Full .htaccess support\n\n Free Subdomain Names\n Free SSL on all your domains\n Free DNS Service\n","Link":"https://xyz.net/"} -----------------------------109489214315235477653070397970 Content-Disposition: form-data; name="entity_id" iwd -----------------------------109489214315235477653070397970--

The problem is in the Description Field

the exact data is as follow (with the blank line at the end):

Free Hosting Features
Everything you could possibly need for your website.

    Unlimited Disk Space
    Unlimited Bandwidth
    400 MySQL Databases

    PHP 5.4, 5.5, 5.6, 7.4
    MySQL 5.6
    Full .htaccess support

    Free Subdomain Names
    Free SSL on all your domains
    Free DNS Service

Axios Request

const headers = {
      'accept': 'application/json',
      'content-type': 'application/json'
    }
const request = {
        method: 'POST',
        url: 'https://service.mydomain.com/api/entity/record/4',
        data: requestData,
        headers: headers,
        crossDomain: true,
        timeout: 300000
      }
axios(request).then(response => {
   // handle response here ...
})

I have test this request with normal input that doesn't contains \n it works fine.

0 likes
0 replies

Please or to participate in this conversation.