public function testExtensionsAlwaysOverwritten()
 {
     $ext1 = ['defdata' => 'fghi'];
     $ext2 = ['data1' => '1234', 'data2' => 'abcd'];
     $problem = new HTTPProblem(400, 'msg', $ext1);
     $this->assertSame($ext1, $problem->extensions());
     $problem->withExtensions($ext2);
     $this->assertSame($ext2, $problem->extensions());
 }
 /**
  * {@inheritdoc}
  */
 public function body(HTTPProblem $problem)
 {
     $data = ['status' => $problem->status()];
     if ($problem->title()) {
         $data['title'] = $problem->title();
     }
     if (!in_array($problem->type(), [null, 'about:blank'], true)) {
         $data['type'] = $problem->type();
     }
     if ($problem->detail()) {
         $data['detail'] = $problem->detail();
     }
     if ($problem->instance()) {
         $data['instance'] = $problem->instance();
     }
     $data += $problem->extensions();
     return json_encode($data, $this->encodingOptions);
 }