fix(google): use stable translation endpoint
This commit is contained in:
1 parent
9edbbef5ad
commit
d885923253
2 files changed
+2
-2
No files matched your search
@@ -29,7 +29,7 @@ export async function translateWithGoogle(
|
||||
|
||||
// Construct the request to Google Translate's internal API
|
||||
const googleApiUrl = new URL(
|
||||
"https://translate.google.com/translate_a/single"
|
||||
"https://translate.googleapis.com/translate_a/single"
|
||||
);
|
||||
googleApiUrl.searchParams.append("client", "gtx"); // Google Translate web client
|
||||
googleApiUrl.searchParams.append(
|
||||
|
||||
@@ -41,7 +41,7 @@ describe("Google Translate Service", () => {
|
||||
expect(result.source_lang).toBe("EN");
|
||||
expect(result.target_lang).toBe("ES");
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
expect.stringContaining("translate.google.com"),
|
||||
expect.stringContaining("translate.googleapis.com"),
|
||||
expect.objectContaining({
|
||||
method: "GET",
|
||||
headers: expect.objectContaining({
|
||||
|
||||
Reference in new issue
Block a user