Skip to content

Commit

Permalink
Working
Browse files Browse the repository at this point in the history
  • Loading branch information
robotdan committed Jan 23, 2025
1 parent 5c2ba2e commit a01f5ec
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/test/java/org/primeframework/mvc/test/RequestBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2024, Inversoft Inc., All Rights Reserved
* Copyright (c) 2012-2025, Inversoft Inc., All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -45,7 +45,6 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.inject.ConfigurationException;
import com.google.inject.Injector;
import io.fusionauth.http.Cookie;
import io.fusionauth.http.Cookie.SameSite;
Expand Down Expand Up @@ -847,15 +846,8 @@ HTTPResponseWrapper run() {
}
}

// Optionally allow the caller to consume the HTTP request in order to mutate it and what not.
try {
injector.getBinding(HTTPRequestConsumer.class);
HTTPRequestConsumer httpRequestConsumer = injector.getInstance(HTTPRequestConsumer.class);
if (httpRequestConsumer != null) {
httpRequestConsumer.accept(request);
}
} catch (ConfigurationException ignore) {
}
// Allow the caller to consume the HTTP request in order to mutate it and what not.
injector.getInstance(HTTPRequestConsumer.class).accept(request);

List<Locale> locales = request.getLocales();
String contentType = request.getContentType();
Expand Down Expand Up @@ -979,10 +971,11 @@ private void setRequestBodyParameter(String name, Object value) {
requestBodyParameters.put(name, values);
}

public interface HTTPRequestConsumer {
public static class HTTPRequestConsumer {
/**
* @param httpRequest the http request
*/
void accept(HTTPRequest httpRequest);
void accept(HTTPRequest httpRequest) {
}
}
}

0 comments on commit a01f5ec

Please sign in to comment.