Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.jknack.handlebars.Context;
Expand Down Expand Up @@ -1382,20 +1383,40 @@ protected Response postWithBodyAndBearerTokenForAutoGeneratedId(String url, Stri
return response;
}
}

protected Response postWithBodyAndCookieForAutoGeneratedIdForUrlEncoded(String url, String jsonInput,
String testCaseName, String idKeyName) throws SecurityXSSException {
Response response = null;
String inputJson = inputJsonKeyWordHandeler(jsonInput, testCaseName);
ObjectMapper mapper = new ObjectMapper();
Map<String, String> map = null;
Map<String, String> formData = new HashMap<>();

try {
map = mapper.readValue(inputJson, Map.class);
@SuppressWarnings("unchecked")
Map<String, Object> jsonMap = mapper.readValue(inputJson, Map.class);

// conversion: simple strings → raw values, complex → JSON strings
for (Map.Entry<String, Object> entry : jsonMap.entrySet()) {
Object value = entry.getValue();
String formValue;

if (value instanceof String) {
// String values should remain raw
formValue = (String) value;
} else {
// Arrays/objects/other types → JSON string
formValue = mapper.writeValueAsString(value);
}

formData.put(entry.getKey(), formValue);
}

logger.info(GlobalConstants.POST_REQ_URL + url);
logger.info(inputJson);

GlobalMethods.reportRequest(null, inputJson, url);
response = RestClient.postRequestWithFormDataBody(url, map);
// check if X-XSS-Protection is enabled or not

response = RestClient.postRequestWithFormDataBody(url, formData);

GlobalMethods.checkXSSProtectionHeader(response, url);
GlobalMethods.reportResponse(response.getHeaders().asList().toString(), url, response);

Expand All @@ -1408,7 +1429,6 @@ protected Response postWithBodyAndCookieForAutoGeneratedIdForUrlEncoded(String u
keyName = ESIGNETUINCOOKIESRESPONSE;
else
keyName = ESIGNETVIDCOOKIESRESPONSE;

CertsUtil.addCertificateToCache(keyName, response.getBody().asString());
}

Expand All @@ -1426,6 +1446,7 @@ protected Response postWithBodyAndCookieForAutoGeneratedIdForUrlEncoded(String u
}
}


protected Response patchWithBodyAndCookieWithAutoGeneratedId(String url, String jsonInput, String cookieName,
String role, String testCaseName, String idKeyName) throws SecurityXSSException {
Response response = null;
Expand Down
Loading