@@ -509,6 +509,39 @@ func TestClientNewRequest(t *testing.T) {
509
509
assertNotNil (t , request )
510
510
}
511
511
512
+
513
+ func TestClientSetJSONMarshaler (t * testing.T ) {
514
+ m := func (v interface {}) ([]byte , error ) { return nil ,nil }
515
+ c := New ().SetJSONMarshaler (m )
516
+ p1 := fmt .Sprintf ("%p" , c .JSONMarshal )
517
+ p2 := fmt .Sprintf ("%p" , m )
518
+ assertEqual (t , p1 , p2 ) // functions can not be compared, we only can compare pointers
519
+ }
520
+
521
+ func TestClientSetJSONUnmarshaler (t * testing.T ) {
522
+ m := func ([]byte , interface {}) error { return nil }
523
+ c := New ().SetJSONUnmarshaler (m )
524
+ p1 := fmt .Sprintf ("%p" , c .JSONUnmarshal )
525
+ p2 := fmt .Sprintf ("%p" , m )
526
+ assertEqual (t , p1 , p2 ) // functions can not be compared, we only can compare pointers
527
+ }
528
+
529
+ func TestClientSetXMLMarshaler (t * testing.T ) {
530
+ m := func (v interface {}) ([]byte , error ) { return nil ,nil }
531
+ c := New ().SetXMLMarshaler (m )
532
+ p1 := fmt .Sprintf ("%p" , c .XMLMarshal )
533
+ p2 := fmt .Sprintf ("%p" , m )
534
+ assertEqual (t , p1 , p2 ) // functions can not be compared, we only can compare pointers
535
+ }
536
+
537
+ func TestClientSetXMLUnmarshaler (t * testing.T ) {
538
+ m := func ([]byte , interface {}) error { return nil }
539
+ c := New ().SetXMLUnmarshaler (m )
540
+ p1 := fmt .Sprintf ("%p" , c .XMLUnmarshal )
541
+ p2 := fmt .Sprintf ("%p" , m )
542
+ assertEqual (t , p1 , p2 ) // functions can not be compared, we only can compare pointers
543
+ }
544
+
512
545
func TestDebugBodySizeLimit (t * testing.T ) {
513
546
ts := createGetServer (t )
514
547
defer ts .Close ()
0 commit comments