Skip to content

Commit 309dde9

Browse files
refactor: update batchSend method in MailtrapClient to encode requests before sending
1 parent 018e75f commit 309dde9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib/MailtrapClient.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,13 @@ export default class MailtrapClient {
150150
const url = `${host}/api/batch${ifSandbox}`;
151151

152152
const preparedBase = base ? encodeMailBuffers(base) : undefined;
153+
const preparedRequests = requests.map((singleRequest) =>
154+
encodeMailBuffers(singleRequest as Partial<Mail>)
155+
);
153156

154157
return this.axios.post<BatchSendResponse, BatchSendResponse>(url, {
155158
base: preparedBase,
156-
requests,
159+
requests: preparedRequests,
157160
});
158161
}
159162
}

0 commit comments

Comments
 (0)