File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
test/java/com/cloudinary/test Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -893,4 +893,13 @@ public T variables(Expression... variables) {
893
893
public T customFunction (CustomFunction action ) {
894
894
return param ("custom_function" , action .toString ());
895
895
}
896
+
897
+ /**
898
+ * Set a custom pre-function, such as a call to a lambda function or a web-assembly function.
899
+ * @param action The custom action to perform, see {@link CustomFunction}.
900
+ * @return The transformation for chaining
901
+ */
902
+ public T customPreFunction (CustomFunction action ) {
903
+ return param ("custom_function" , "pre:" + action .toString ());
904
+ }
896
905
}
Original file line number Diff line number Diff line change @@ -1163,6 +1163,13 @@ public void testCustomFunction(){
1163
1163
new Transformation ().customFunction (remote ("https://df34ra4a.execute-api.us-west-2.amazonaws.com/default/cloudinaryFunction" )).generate ());
1164
1164
}
1165
1165
1166
+ @ Test
1167
+ public void testCustomPreFunction (){
1168
+ assertEquals ("fn_pre:wasm:blur_wasm" , new Transformation ().customPreFunction (wasm ("blur_wasm" )).generate ());
1169
+ assertEquals ("fn_pre:remote:aHR0cHM6Ly9kZjM0cmE0YS5leGVjdXRlLWFwaS51cy13ZXN0LTIuYW1hem9uYXdzLmNvbS9kZWZhdWx0L2Nsb3VkaW5hcnlGdW5jdGlvbg==" ,
1170
+ new Transformation ().customPreFunction (remote ("https://df34ra4a.execute-api.us-west-2.amazonaws.com/default/cloudinaryFunction" )).generate ());
1171
+ }
1172
+
1166
1173
public static Map <String , String > getUrlParameters (URI uri ) throws UnsupportedEncodingException {
1167
1174
Map <String , String > params = new HashMap <String , String >();
1168
1175
for (String param : uri .getRawQuery ().split ("&" )) {
You can’t perform that action at this time.
0 commit comments