Update your GET requests to remove request bodies
Your system may be sending GET requests that include a request body, which isn’t compliant with HTTP standards. While Recharge currently ignores the body on these requests, an upcoming load balancer update will block them entirely.
This guide explains how to update your implementation so your GET requests no longer include a body, ensuring your integration continues to function as expected once the load balancer change is in place.
Summary
To prevent request failures, update your implementation to remove the data property from GET requests. Updating your implementation ensures that:
- Your requests follow the HTTP standard, which doesn’t allow bodies on GET requests.
- Your integrations remain compatible with load balancers and proxies that reject GET requests with bodies.
- Your API calls continue to succeed once enforcement begins, as requests with bodies will soon return a 400 Bad Request.
Axios
Recharge will soon reject any GET request that includes a request body. You should remove the data property and keep your params exactly as they are to ensure everything works correctly.
For example, if you have code requests such as:
axios.get('/api/orders', {
data: { userId: 123 },
params: { status: 'open' }
});
You should change it to this:
axios.get('/api/orders', {
params: { status: 'open' }
});Example
const axios = require('axios');
// Create an Axios instance
const client = axios.create();
// Request interceptor to log everything
client.interceptors.request.use(request => {
console.log('--- REQUEST ---');
console.log('Method:', request.method.toUpperCase());
console.log('URL:', request.url);
console.log('Headers:', request.headers);
console.log('Body:', request.data);
console.log('---------------\n');
return request;
});
// Response interceptor to log everything
client.interceptors.response.use(response => {
console.log('--- RESPONSE ---');
console.log('Status:', response.status);
console.log('Headers:', response.headers);
console.log('Data:', response.data);
console.log('----------------\n');
return response;
}, error => {
if (error.response) {
console.log('--- RESPONSE ERROR ---');
console.log('Status:', error.response.status);
console.log('Headers:', error.response.headers);
console.log('Data:', error.response.data);
console.log('----------------------\n');
} else {
console.error('Error:', error.message);
}
return Promise.reject(error);
});
// Make GET request with empty body and custom auth header, this request will be blocked soon
async function getWithEmptyBody() {
try {
const response = await client({
method: 'get',
url: 'https://api.stage.rechargeapps.com/discounts', // example API
headers: {
'Content-Type': 'application/json',
'X-Recharge-Access-Token': 'SUPER_SECRET!!!',
},
// data: {""} // empty body that will cause the request to be blocked
});
console.log('Final Response Data:', response.data);
} catch (error) {
console.error('Request failed');
}
}
getWithEmptyBody();Advanced Interceptor Solution
Typescript
import axios from 'axios';
axios.interceptors.request.use((config) => {
const method = (config.method || 'get').toUpperCase();
if (method === 'GET' && 'data' in config) {
// Drop any GET body without touching existing params
delete (config as any).data;
// Clean body-related headers that some libs add by habit
const h = config.headers || {};
const lower = (k: string) => k.toLowerCase();
for (const key of Object.keys(h)) {
if (['content-type', 'content-length', 'transfer-encoding'].includes(lower(key))) {
// @ts-expect-error index signature
delete h[key];
}
}
config.headers = h;
}
return config;
});Incorrect usage
axios.get('/api/...', { data: {...}, params: {...} });
axios({ method: 'get', data: {...}, params: {...} });Correct usage
axios.get('/api/...', { params: {...} })Incorrect usage
axios.get('/api/...', { data: {...}, params: {...} });
axios({ method: 'get', data: {...}, params: {...} });Correct usage
axios.get('/api/...', { params: {...} })Curl
To ensure the implementation works, you must remove the request body and keep your query parameters unchanged.
curl -X GET https://api.rechargeapps.com/api/orders?status=open \
-H "Content-Type: application/json" \
-d '{"userId":123}'You should change it to something like this:
curl -X GET "https://api.rechargeapps.com/api/orders?status=open"Incorrect usage
curl -X GET -d '{"key":"value"}' https://api...Correct usage
curl -X GET https://api...Incorrect usage
curl -X GET --data-urlencode "userId=123"Correct usage
remove --data-urlencodeIncorrect usage
curl -H "Content-Type: application/json" -X GET -d ...Correct usage
curl -X GET "https://api..."Deepconverse Automation
To ensure the implementation works, you must remove the Body section from GET requests when adding or editing an HTTP request, and keep your query parameters exactly as they are.
For example, if your request looks like this:
Method: GET
Endpoint: https://api.rechargeapps.com/api/orders
Query Parameters:
status = open
Request Body:
{
"userId": 123
}You should remove the Body section, as shown below:
Method: GET
Endpoint: https://api.rechargeapps.com/api/orders
Query Parameters:
status = openBest practices
| Incorrect usage | Correct usage |
|---|---|
GET with JSON or text in the Body tab | Remove the Request body |
| Sending filters or IDs in JSON | Remove the filters or IDs |
Go-http-client
To ensure the implementation works, you must remove the request body and keep your query parameters unchanged.
For example, if you have code requests such as:
req, _ := http.NewRequest("GET", "https://api.rechargeapps.com/api/orders", strings.NewReader(`{"userId":123}`))
q := req.URL.Query()
q.Add("status", "open")
req.URL.RawQuery = q.Encode()
resp, _ := http.DefaultClient.Do(req)You should change it to this:
req, _ := http.NewRequest("GET", "https://api.rechargeapps.com/api/orders", nil)
q := req.URL.Query()
q.Add("status", "open")
req.URL.RawQuery = q.Encode()
resp, _ := http.DefaultClient.Do(req)Incorrect usage
http.NewRequest("GET", url, strings.NewReader(...))Correct usage
http.NewRequest("GET", url, nil)Incorrect usage
http.NewRequestWithContext(ctx, http.MethodGet, url, bytes.NewReader(...))Correct usage
http.NewRequestWithContext(ctx, http.MethodGet, url, nil)GuzzleHTTP
To ensure the implementation works, you must remove any json, body, or form_params options from GET requests, and keep your query parameters exactly as they are.
For example, if you have code requests such as:
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', '/api/orders', [
'json' => ['userId' => 123],
'query' => ['status' => 'open']
]);You should change it to this:
$response = $client->request('GET', '/api/orders', [
'query' => ['status' => 'open']
]);Incorrect usage
$client->get('/api/...', ['json' => [...], 'query' => [...]])Correct usage
$client->get('/api/...', ['query' => [...]])Incorrect usage
$client->request('GET', '/api/...', ['body' => '...'])Correct usage
$client->request('GET', '/api/...', ['query' => [...]])Incorrect usage
$client->request('GET', '/api/...', ['form_params' => [...]])Correct usage
$client->request('GET', '/api/...', ['query' => [...]])Insomnia
To ensure the implementation works, you must remove the Body section from GET requests, and keep your query parameters exactly as they are.
For example, if your request looks like this:
Method: GET
URL: https://api.rechargeapps.com/api/orders&status=open
Body (JSON):
{
"userId": 123
}You should remove the Body section, as shown below:
Method: GET
URL: https://api.rechargeapps.com/api/orders?&status=openBest practices
| Incorrect usage | Correct usage |
|---|---|
GET with JSON or text in the Body tab | Leave the Body tab empty |
GET with payload { "userId": 123 } | Remove the payload |
| Testing filters by sending JSON body | Remove the body as Recharge ignores it |
Make
To ensure the implementation works, you must remove the Body section from GET requests, and keep your query parameters exactly as they are.
For example, if your request looks like this:
Method: GET
URL: https://api.rechargeapps.com/api/orders
Query String Parameters:
status=open
Body type: Raw (JSON)
Body:
{
"userId": 123
}You should remove the Body section, as shown below:
Method: GET
URL: https://api.rechargeapps.com/api/orders
Query String Parameters:
status=openBest practices
| Incorrect usage | Correct usage |
|---|---|
GET with JSON or text in the Body tab | Leave the Body tab empty |
Using Raw or JSON body with GET | Delete the Raw or JSON |
Postman Runtime
To ensure the implementation works, you must remove the Body section from GET requests, and keep your query parameters exactly as they are.
For example, if your request looks like this:
Method: GET
URL: https://api.rechargeapps.com/api/orders
Body (raw JSON):
{
"userId": 123
}You should remove the Body section, as shown below:
Method: GET
URL: https://api.rechargeapps.com/api/orders?&status=openFor Postman Runtime or Newman Scripts
Check your collection JSON if you're running Postman collections via Newman or PostmanRuntime.
If your request looks like this:
{
"method": "GET",
"url": {
"raw": "https://api.rechargeapps.com/api/orders?status=open",
"query": [
{ "key": "status", "value": "open" }
]
}
"body": {
"mode": "raw",
"raw": "{\"userId\":123}"
}
}Change it to match the following:
{
"method": "GET",
"url": {
"raw": "https://api.rechargeapps.com/api/orders?status=open",
"query": [
{ "key": "status", "value": "open" }
]
}
}Best practices
| Incorrect usage | Correct usage |
|---|---|
GET with JSON or text in the Body tab | Leave the Body tab empty |
GET with raw or form-data body in collection JSON | Just delete raw or form-data body in collection JSON |
Python-Requests
To ensure the implementation works, you must remove any json=, body=, or form_params options from GET requests, and keep your query parameters exactly as they are.
For example, if you have code requests such as:
import requests
response = requests.get(
"https://api.rechargeapps.com/api/orders",
json={"userId": 123},
params={"status": "open"}
)You should change it to this:
response = requests.get(
"https://api.rechargeapps.com/api/orders",
params={"status": "open"}
)Incorrect usage
requests.get(url, json={...}, params={...})Correct usage
requests.get(url, params={...})Incorrect usage
requests.get(url, data={...}, params={...})Correct usage
requests.get(url, params={...})Incorrect usage
requests.request("GET", url, json={...}, params={...})Correct usage
requests.request("GET", url, params={...})Symfony httpclient
To ensure the implementation works, you must remove any json, body, or extra payload options from GET requests, and keep your query parameters exactly as they are.
For example, if you have code requests such as:
use Symfony\Component\HttpClient\HttpClient;
$client = HttpClient::create();
$response = $client->request('GET', 'https://api.rechargeapps.com/api/orders', [
'json' => ['userId' => 123],
'query' => ['status' => 'open'],
]);You should change it to this:
$response = $client->request('GET', 'https://api.rechargeapps.com/api/orders', [
'query' => ['status' => 'open'],
]);Incorrect usage
$client->request('GET', $url, ['query' => [...]], ['json' => [...]])Correct usage
$client->request('GET', $url, ['query' => [...]])Incorrect usage
$client->request('GET', $url, ['query' => [...]], ['body' => '...'])Correct usage
$client->request('GET', $url, ['query' => [...]])Incorrect usage
$client->request('GET', $url, ['query' => [...]], ['extra' => ['body' => ...]])Correct usage
$client->request('GET', $url, ['query' => [...]])Updated 2 days ago
