bearer method

TestRequest bearer(
  1. String token
)

Set Bearer token authentication header.

Sets the Authorization header with a Bearer token, commonly used for JWT or OAuth token authentication.

Example:

testApp.get('/api/profile')
  .bearer('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...');

token The bearer token (without 'Bearer ' prefix). Returns this request builder for method chaining.

Implementation

TestRequest bearer(String token) {
  return header('authorization', 'Bearer $token');
}