2626import java .util .Map ;
2727import java .util .Set ;
2828import java .util .UUID ;
29+ import java .util .function .Supplier ;
2930import java .util .function .UnaryOperator ;
3031import java .util .regex .Matcher ;
3132import java .util .regex .Pattern ;
7071import io .apimatic .core .types .OneOfValidationException ;
7172import io .apimatic .core .types .http .request .MultipartFileWrapper ;
7273import io .apimatic .core .types .http .request .MultipartWrapper ;
74+ import io .apimatic .coreinterfaces .http .HttpHeaders ;
7375import io .apimatic .coreinterfaces .http .request .ArraySerializationFormat ;
7476import io .apimatic .coreinterfaces .http .request .Request ;
7577import io .apimatic .coreinterfaces .http .response .Response ;
@@ -1611,10 +1613,10 @@ public static Map<String, Object> getQueryParameters(String queryUrl) {
16111613 * @return The resolved value as a string, or null if not found.
16121614 */
16131615 public static String resolveResponsePointer (String pointer , Response response ) {
1614- return resolveJsonPointer (pointer , response . getBody () , response . getHeaders (). asSimpleMap () );
1616+ return resolveJsonPointer (pointer , response :: getBody , response :: getHeaders );
16151617 }
16161618
1617- private static String resolveJsonPointer (String pointer , String jsonBody , Map < String , String > headers ) {
1619+ private static String resolveJsonPointer (String pointer , Supplier < String > jsonBody , Supplier < HttpHeaders > headers ) {
16181620 if (pointer == null ) {
16191621 return null ;
16201622 }
@@ -1625,10 +1627,10 @@ private static String resolveJsonPointer(String pointer, String jsonBody, Map<St
16251627
16261628 switch (prefix ) {
16271629 case "$response.body" :
1628- return CoreHelper .getValueFromJson (point , jsonBody );
1630+ return CoreHelper .getValueFromJson (point , jsonBody . get () );
16291631 case "$response.headers" :
16301632 return CoreHelper .getValueFromJson (point ,
1631- trySerialize (headers ));
1633+ trySerialize (headers . get (). asSimpleMap () ));
16321634 default :
16331635 return null ;
16341636 }
@@ -1642,7 +1644,7 @@ private static String resolveJsonPointer(String pointer, String jsonBody, Map<St
16421644 * @return The resolved value as a string, or null if not found.
16431645 */
16441646 public static String resolveRequestPointer (String pointer , Request request ) {
1645- return resolveJsonPointer (pointer , request .getBody ().toString (), request . getHeaders (). asSimpleMap () );
1647+ return resolveJsonPointer (pointer , () -> request .getBody ().toString (), request :: getHeaders );
16461648 }
16471649
16481650 /**
0 commit comments