Inform AI engine which endpoints are disabled on the backend (#6251)
# Description of Changes Have the Java send a list of enabled endpoints to the AI engine so it can intelligently respond to the user that the tool does exist but is disabled on the server so it can't acutally run the operation, instead of the current behaviour where it sends the API call back and then 503 errors because the execution fails when the URL is disabled. <img width="380" height="208" alt="image" src="https://github.com/user-attachments/assets/5842fb2e-2e55-45a5-8205-25515636daae" /> --------- Co-authored-by: EthanHealy01 <80844253+EthanHealy01@users.noreply.github.com>
This commit is contained in:
co-authored by
EthanHealy01
parent
5541dd666c
commit
51f5345151
@@ -0,0 +1,39 @@
|
||||
package stirling.software.SPDF.config;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class EndpointConfigurationTest {
|
||||
|
||||
@Test
|
||||
void endpointKeyForUriExtractsSimpleKebab() {
|
||||
assertEquals(
|
||||
"remove-pages",
|
||||
EndpointConfiguration.endpointKeyForUri("/api/v1/general/remove-pages"));
|
||||
assertEquals(
|
||||
"compress-pdf",
|
||||
EndpointConfiguration.endpointKeyForUri("/api/v1/misc/compress-pdf"));
|
||||
assertEquals(
|
||||
"add-watermark",
|
||||
EndpointConfiguration.endpointKeyForUri("/api/v1/security/add-watermark"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void endpointKeyForUriComposesConvertEndpoints() {
|
||||
assertEquals(
|
||||
"pdf-to-img", EndpointConfiguration.endpointKeyForUri("/api/v1/convert/pdf/img"));
|
||||
assertEquals(
|
||||
"pdf-to-word", EndpointConfiguration.endpointKeyForUri("/api/v1/convert/pdf/word"));
|
||||
assertEquals(
|
||||
"html-to-pdf", EndpointConfiguration.endpointKeyForUri("/api/v1/convert/html/pdf"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void endpointKeyForUriReturnsNullForNonApiPaths() {
|
||||
assertNull(EndpointConfiguration.endpointKeyForUri(null));
|
||||
assertNull(EndpointConfiguration.endpointKeyForUri("/some-page"));
|
||||
assertNull(EndpointConfiguration.endpointKeyForUri("/api/v1/general"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user