Commit Graph

3 Commits

Author SHA1 Message Date
Bonny07
09231c2650 fix(service): validate request body on /translate and /v1/translate
The two handlers ignored the error from c.BindJSON, so a malformed JSON body was silently processed as an empty payload. Check the error and return 400, consistent with /v2/translate.
2026-05-31 23:54:26 +09:00
Bonny Lin
3f099d187c
fix(service): return 500 instead of crashing on translation error (#224)
The /translate, /v1/translate and /v2/translate handlers called log.Fatalf when TranslateByDeepLX returned an error. log.Fatalf calls os.Exit, so a single failed translation would tear down the whole server process. Return a 500 JSON response and keep serving instead.
2026-05-31 03:47:09 -07:00
Jason Lyu
0a9ff6b582
refactor: make service exportable (#183) 2025-04-08 13:53:20 -04:00