柏树斑点给出错误,无法执行ATOB'在窗口上,带有MKV文件
我需要在请求中使用MKV文件测试API。
我对此使用以下代码:
cy.fixture('video.mkv').then(file => {
const blob = Cypress.Blob.base64StringToBlob(file, "video/x-matroska")
cy.request({
method: ...
url: ...
body: blob,
})
});
最后,我有一个错误:
“ InvalidCharacterError 要解码的字符串包含Latin1范围之外的字符
。
无法在“窗口”上执行“ ATOB” : 柏树V10.0.0 你能帮我吗?
I need to test API, with a MKV file in the request.
I use the following code for that:
cy.fixture('video.mkv').then(file => {
const blob = Cypress.Blob.base64StringToBlob(file, "video/x-matroska")
cy.request({
method: ...
url: ...
body: blob,
})
});
Finally, I have this error:
"InvalidCharacterError
Failed to execute 'atob' on 'Window': The string to be decoded contains characters outside of the Latin1 range."
I'm not sure that, for MKV file, I should convert base64 strings to Blob objects.
FYI: I test with Cypress v10.0.0
Can you help me, please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您正在寻找
arrayBufferToblob
这些是可用的和
arrayBufferToblob
看起来可能(至少没有错误)。如果在此上没有进行的其他方法,请尝试其他方法。
I think you are looking for
arrayBufferToBlob
These are the available Blob functions, and
arrayBufferToBlob
looks likely (at least, no errors).Try out other methods if no-go on this one.
实际上,使用MKV文件,看来我不需要转换为blob对象,因为该文件已通过此文件发送了很好的发送:
但是,在请求后,视频始终会损坏。
以下是用于比较的文件内容:
原始内容:

输出内容:

我们可以看到一个零件是修改的,例如一开始,'a3',取而代之的是'ef bf bd'
请注意,此服务效果很好,Ouside cypress,我们能够检索输出视频。
In fact, with a MKV file, it appears that I don't need to convert to blob object, as the request is well sent with this file:
However, the video is always damaged after the request.
Here are file content for comparison, before and after:
Original content:

Output content:

We can see that a part was modified, like 'A3' at the beginning, replaced by 'EF BF BD'
Note that this service works fine, ouside Cypress, and we are able to retrieve output video.