Fix off-by-one error in range requests
Summary: https://github.com/facebook/react-native/pull/8219 adds range requests to the asset server, but there was an off-by-one-error that made responses end prematurely. This made (for example) react-native-video not work for video assets. This change fixes the off-by-one error and react-native-video works with assets. **Test plan (required)** Try the test in the original pull request for range requests: https://github.com/facebook/react-native/pull/8219 Closes https://github.com/facebook/react-native/pull/9254 Differential Revision: D3680070 fbshipit-source-id: 3f2a18ba9f35b45b340f4a1046bc099b8444eb7d
This commit is contained in:
parent
bdf5adc40b
commit
a2417065b1
|
@ -362,7 +362,7 @@ describe('processRequest', () => {
|
|||
server.processRequest(req, res);
|
||||
jest.runAllTimers();
|
||||
expect(AssetServer.prototype.get).toBeCalledWith('imgs/a.png', 'ios');
|
||||
expect(res.end).toBeCalledWith(mockData.slice(0, 3));
|
||||
expect(res.end).toBeCalledWith(mockData.slice(0, 4));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ class Server {
|
|||
'Content-Type': mime.lookup(path.basename(assetPath[1]))
|
||||
});
|
||||
|
||||
return data.slice(dataStart, dataEnd);
|
||||
return data.slice(dataStart, dataEnd + 1);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
|
Loading…
Reference in New Issue