@@ -566,10 +566,25 @@ public final ObjectNode post(String path, ObjectNode request, Consumer<Request>.
566
566
}
567
567
568
568
@ SafeVarargs
569
- public final ObjectNode postEntity (String path , HttpEntity entity , Consumer <Request >... consumers ) {
569
+ public final ObjectNode put (String path , ObjectNode request , Consumer <Request >... consumers ) {
570
+ return putEntity (path , entity (request ), consumers );
571
+ }
572
+
573
+ public final ObjectNode postEntity (String path , HttpEntity entity , Consumer <Request >... consumers )
574
+ {
575
+ return sendEntity (POST , path , entity , consumers );
576
+ }
577
+
578
+ public final ObjectNode putEntity (String path , HttpEntity entity , Consumer <Request >... consumers )
579
+ {
580
+ return sendEntity (PUT , path , entity , consumers );
581
+ }
582
+
583
+ @ SafeVarargs
584
+ public final ObjectNode sendEntity (String method , String path , HttpEntity entity , Consumer <Request >... consumers ) {
570
585
try {
571
586
572
- Request req = new Request (POST , path );
587
+ Request req = new Request (method , path );
573
588
req .setEntity (entity );
574
589
for (Consumer <Request > c : consumers ) {
575
590
c .accept (req );
@@ -679,7 +694,7 @@ public ObjectNode index(String id, byte[] o) {
679
694
public ObjectNode index (String id , Object o , Consumer <ObjectNode > sourceConsumer ) {
680
695
ObjectNode jsonNode = objectMapper .valueToTree (o );
681
696
sourceConsumer .accept (jsonNode );
682
- return post (indexPath (id ), jsonNode );
697
+ return put (indexPath (id ), jsonNode );
683
698
}
684
699
685
700
0 commit comments