This repository was archived by the owner on Oct 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -123,8 +123,8 @@ export default class PostgrestTransformBuilder<T> extends PostgrestBuilder<T> {
123
123
/**
124
124
* Set the response type to CSV.
125
125
*/
126
- csv ( ) : this {
126
+ csv ( ) : PromiseLike < PostgrestSingleResponse < string > > {
127
127
this . headers [ 'Accept' ] = 'text/csv'
128
- return this
128
+ return this as PromiseLike < PostgrestSingleResponse < string > >
129
129
}
130
130
}
Original file line number Diff line number Diff line change @@ -104,8 +104,13 @@ export abstract class PostgrestBuilder<T> implements PromiseLike<PostgrestRespon
104
104
const isReturnMinimal = this . headers [ 'Prefer' ] ?. split ( ',' ) . includes ( 'return=minimal' )
105
105
if ( this . method !== 'HEAD' && ! isReturnMinimal ) {
106
106
const text = await res . text ( )
107
- if ( text && text !== '' && this . headers [ 'Accept' ] !== 'text/csv' )
107
+ if ( ! text ) {
108
+ // discard `text`
109
+ } else if ( this . headers [ 'Accept' ] === 'text/csv' ) {
110
+ data = text
111
+ } else {
108
112
data = JSON . parse ( text )
113
+ }
109
114
}
110
115
111
116
const countHeader = this . headers [ 'Prefer' ] ?. match ( / c o u n t = ( e x a c t | p l a n n e d | e s t i m a t e d ) / )
You can’t perform that action at this time.
0 commit comments