|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package au.com.royalpay.payment.manage.shopify.support;
|
|
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.web.util.ContentCachingRequestWrapper;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
@ -8,9 +10,12 @@ import java.io.IOException;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
|
|
|
|
|
public class ShopifyHttpUtils {
|
|
|
|
|
private ShopifyHttpUtils(){}
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ShopifyHttpUtils.class);
|
|
|
|
|
|
|
|
|
|
public static String getRequestBody(HttpServletRequest request) {
|
|
|
|
|
if (request instanceof ContentCachingRequestWrapper) {
|
|
|
|
|
logger.info("Shopify Request Cached, read directly");
|
|
|
|
|
return new String(((ContentCachingRequestWrapper) request).getContentAsByteArray(), StandardCharsets.UTF_8);
|
|
|
|
|
}
|
|
|
|
|
BufferedReader br = null;
|
|
|
|
|