Skip to content

Commit

Permalink
fix: add setHeader to more classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Aug 15, 2024
1 parent 1914280 commit 908b8e7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/postgrest/lib/src/postgrest_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ class PostgrestBuilder<T, S, R> implements Future<T> {
);
}

PostgrestBuilder<T, S, R> setHeader(String key, String value) {
return _copyWith(
headers: {..._headers, key: value},
);
}

Future<T> _execute() async {
final String? method = _method;

Expand Down
1 change: 1 addition & 0 deletions packages/postgrest/lib/src/postgrest_filter_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
return copyWithUrl(url);
}

@override
PostgrestFilterBuilder<T> setHeader(String key, String value) {
return PostgrestFilterBuilder(
_copyWith(headers: {..._headers, key: value}),
Expand Down
1 change: 1 addition & 0 deletions packages/postgrest/lib/src/postgrest_query_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ class PostgrestQueryBuilder<T> extends RawPostgrestBuilder<T, T, T> {
));
}

@override
PostgrestQueryBuilder<T> setHeader(String key, String value) {
return PostgrestQueryBuilder(
url: _url,
Expand Down
7 changes: 7 additions & 0 deletions packages/postgrest/lib/src/postgrest_transform_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ class PostgrestTransformBuilder<T> extends RawPostgrestBuilder<T, T, T> {
PostgrestTransformBuilder<T> copyWithUrl(Uri url) =>
PostgrestTransformBuilder(_copyWith(url: url));

@override
PostgrestTransformBuilder<T> setHeader(String key, String value) {
return PostgrestTransformBuilder(
_copyWith(headers: {..._headers, key: value}),
);
}

/// Performs horizontal filtering with SELECT.
///
/// ```dart
Expand Down
7 changes: 7 additions & 0 deletions packages/postgrest/lib/src/raw_postgrest_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class RawPostgrestBuilder<T, S, R> extends PostgrestBuilder<T, S, R> {
));
}

@override
RawPostgrestBuilder<T, S, R> setHeader(String key, String value) {
return PostgrestFilterBuilder(
_copyWithType(headers: {..._headers, key: value}),
);
}

/// Converts any response that comes from the server into a type-safe response.
///
/// ```dart
Expand Down
7 changes: 7 additions & 0 deletions packages/postgrest/lib/src/response_postgrest_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ class ResponsePostgrestBuilder<T, S, R> extends PostgrestBuilder<T, S, R> {
converter: builder._converter,
);

@override
ResponsePostgrestBuilder<T, S, R> setHeader(String key, String value) {
return ResponsePostgrestBuilder(
_copyWith(headers: {..._headers, key: value}),
);
}

/// Converts any response that comes from the server into a type-safe response.
///
/// ```dart
Expand Down

0 comments on commit 908b8e7

Please sign in to comment.