@@ -706,10 +706,22 @@ <h3>${titleCased}</h3>
706706 }
707707 } ;
708708
709+ // Concatenate array body (isomorphic-git sends body as array of Uint8Arrays)
710+ function concatBody ( body ) {
711+ if ( ! Array . isArray ( body ) ) return body ;
712+ const chunks = body . map ( c => c instanceof Uint8Array ? c : new Uint8Array ( c ) ) ;
713+ const totalLength = chunks . reduce ( ( sum , c ) => sum + c . length , 0 ) ;
714+ const result = new Uint8Array ( totalLength ) ;
715+ let offset = 0 ;
716+ for ( const chunk of chunks ) {
717+ result . set ( chunk , offset ) ;
718+ offset += chunk . length ;
719+ }
720+ return result ;
721+ }
722+
709723 // Create HTTP client with NIP-98 auth for git operations
710724 function createNip98HttpClient ( privkey ) {
711- const baseHttp = createHttpClient ( ) ;
712-
713725 return {
714726 async request ( { url, method, headers, body } ) {
715727 // Create NIP-98 auth event
@@ -732,13 +744,21 @@ <h3>${titleCased}</h3>
732744 // Base64 encode the event
733745 const authHeader = 'Nostr ' + btoa ( JSON . stringify ( signedEvent ) ) ;
734746
735- // Add auth header
736- const authHeaders = {
737- ...headers ,
738- 'Authorization' : authHeader
739- } ;
747+ // Concatenate body if array and make request
748+ const res = await fetch ( url , {
749+ method,
750+ headers : { ...headers , 'Authorization' : authHeader } ,
751+ body : concatBody ( body )
752+ } ) ;
740753
741- return baseHttp . request ( { url, method, headers : authHeaders , body } ) ;
754+ return {
755+ url : res . url ,
756+ method,
757+ statusCode : res . status ,
758+ statusMessage : res . statusText ,
759+ headers : Object . fromEntries ( res . headers . entries ( ) ) ,
760+ body : [ new Uint8Array ( await res . arrayBuffer ( ) ) ]
761+ } ;
742762 }
743763 } ;
744764 }
0 commit comments