Refactor package structure for Prestashop components and enhance raw query handling in PrestashopProxyController
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package fr.gameovergne.api.config;
|
package fr.gameovergne.api.config.prestashop;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package fr.gameovergne.api.controller;
|
package fr.gameovergne.api.controller;
|
||||||
|
|
||||||
import fr.gameovergne.api.service.PrestashopClient;
|
import fr.gameovergne.api.service.prestashop.PrestashopClient;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -10,6 +10,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.HandlerMapping;
|
import org.springframework.web.servlet.HandlerMapping;
|
||||||
|
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/ps")
|
@RequestMapping("/api/ps")
|
||||||
public class PrestashopProxyController {
|
public class PrestashopProxyController {
|
||||||
@@ -31,6 +34,10 @@ public class PrestashopProxyController {
|
|||||||
.extractPathWithinPattern(bestMatchPattern, fullPath);
|
.extractPathWithinPattern(bestMatchPattern, fullPath);
|
||||||
|
|
||||||
String rawQuery = request.getQueryString();
|
String rawQuery = request.getQueryString();
|
||||||
|
if (rawQuery != null) {
|
||||||
|
// 🔥 Correction : on désencode les caractères URL avant de relayer à Presta
|
||||||
|
rawQuery = URLDecoder.decode(rawQuery, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
ResponseEntity<String> prestaResponse =
|
ResponseEntity<String> prestaResponse =
|
||||||
prestashopClient.getWithRawQuery("/" + relativePath, rawQuery);
|
prestashopClient.getWithRawQuery("/" + relativePath, rawQuery);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package fr.gameovergne.api.service;
|
package fr.gameovergne.api.service.prestashop;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
Reference in New Issue
Block a user