(t *testing.T)
| 1520 | } |
| 1521 | |
| 1522 | func Test_Request_Error_Body_With_Server(t *testing.T) { |
| 1523 | t.Parallel() |
| 1524 | t.Run("json error", func(t *testing.T) { |
| 1525 | t.Parallel() |
| 1526 | testRequestFail( |
| 1527 | t, |
| 1528 | func(c fiber.Ctx) error { |
| 1529 | return c.SendString("") |
| 1530 | }, |
| 1531 | func(agent *Request) { |
| 1532 | agent.SetJSON(complex(1, 1)) |
| 1533 | }, |
| 1534 | errors.New("json: unsupported type: complex128"), |
| 1535 | ) |
| 1536 | }) |
| 1537 | |
| 1538 | t.Run("xml error", func(t *testing.T) { |
| 1539 | t.Parallel() |
| 1540 | testRequestFail( |
| 1541 | t, |
| 1542 | func(c fiber.Ctx) error { |
| 1543 | return c.SendString("") |
| 1544 | }, |
| 1545 | func(agent *Request) { |
| 1546 | agent.SetXML(complex(1, 1)) |
| 1547 | }, |
| 1548 | errors.New("xml: unsupported type: complex128"), |
| 1549 | ) |
| 1550 | }) |
| 1551 | |
| 1552 | t.Run("form body with invalid boundary", func(t *testing.T) { |
| 1553 | t.Parallel() |
| 1554 | |
| 1555 | _, err := AcquireRequest(). |
| 1556 | SetBoundary("*"). |
| 1557 | AddFileWithReader("t.txt", io.NopCloser(strings.NewReader("world"))). |
| 1558 | Get("http://example.com") |
| 1559 | require.Equal(t, "set boundary error: mime: invalid boundary character", err.Error()) |
| 1560 | }) |
| 1561 | |
| 1562 | t.Run("open non exist file", func(t *testing.T) { |
| 1563 | t.Parallel() |
| 1564 | |
| 1565 | _, err := AcquireRequest(). |
| 1566 | AddFile("non-exist-file!"). |
| 1567 | Get("http://example.com") |
| 1568 | require.Contains(t, err.Error(), "open non-exist-file!") |
| 1569 | }) |
| 1570 | } |
| 1571 | |
| 1572 | func Test_Request_Timeout_With_Server(t *testing.T) { |
| 1573 | t.Parallel() |
nothing calls this directly
no test coverage detected