fix(core): correctly handle result of mtcute.customMethod
This commit is contained in:
parent
c536086310
commit
9daa551e33
1 changed files with 12 additions and 0 deletions
|
@ -40,6 +40,18 @@ async function generateReaders(apiSchema: TlFullSchema, mtpSchema: TlFullSchema)
|
||||||
includeMethodResults: true,
|
includeMethodResults: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// for mtcute.customMethod we want to generate a reader that uses r.raw()
|
||||||
|
const newCode = code.replace(
|
||||||
|
"'mtcute.customMethod':function(r){return r.bytes()},",
|
||||||
|
"'mtcute.customMethod':function(r){return r.raw()},",
|
||||||
|
)
|
||||||
|
|
||||||
|
if (newCode === code) {
|
||||||
|
throw new Error('Failed to replace customMethod writer')
|
||||||
|
}
|
||||||
|
|
||||||
|
code = newCode
|
||||||
|
|
||||||
const mtpCode = generateReaderCodeForTlEntries(mtpSchema.entries, {
|
const mtpCode = generateReaderCodeForTlEntries(mtpSchema.entries, {
|
||||||
variableName: 'm',
|
variableName: 'm',
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue