fix(code_push_protocol): rename upload_url to url for backward compat (#588)
This commit is contained in:
@@ -112,7 +112,7 @@ class CodePushClient {
|
||||
);
|
||||
|
||||
final uploadResponse = await _httpClient.put(
|
||||
Uri.parse(decoded.uploadUrl),
|
||||
Uri.parse(decoded.url),
|
||||
body: File(artifactPath).readAsBytesSync(),
|
||||
);
|
||||
if (uploadResponse.statusCode != HttpStatus.ok) {
|
||||
@@ -169,7 +169,7 @@ class CodePushClient {
|
||||
);
|
||||
|
||||
final uploadResponse = await _httpClient.put(
|
||||
Uri.parse(decoded.uploadUrl),
|
||||
Uri.parse(decoded.url),
|
||||
body: File(artifactPath).readAsBytesSync(),
|
||||
);
|
||||
if (uploadResponse.statusCode != HttpStatus.ok) {
|
||||
|
||||
@@ -246,7 +246,7 @@ void main() {
|
||||
|
||||
test('throws an exception if the upload fails', () async {
|
||||
const artifactId = 42;
|
||||
const uploadUrl = 'https://example.com/artifact.zip';
|
||||
const uploadUrl = 'https://example.com';
|
||||
when(() => httpClient.send(any())).thenAnswer((_) async {
|
||||
return http.StreamedResponse(
|
||||
Stream.value(
|
||||
@@ -259,7 +259,7 @@ void main() {
|
||||
platform: platform,
|
||||
hash: hash,
|
||||
size: size,
|
||||
uploadUrl: uploadUrl,
|
||||
url: uploadUrl,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -302,7 +302,7 @@ void main() {
|
||||
|
||||
test('completes when request succeeds', () async {
|
||||
const artifactId = 42;
|
||||
const uploadUrl = 'https://example.com/artifact.zip';
|
||||
const uploadUrl = 'https://example.com';
|
||||
when(() => httpClient.send(any())).thenAnswer((_) async {
|
||||
return http.StreamedResponse(
|
||||
Stream.value(
|
||||
@@ -315,7 +315,7 @@ void main() {
|
||||
platform: platform,
|
||||
hash: hash,
|
||||
size: size,
|
||||
uploadUrl: uploadUrl,
|
||||
url: uploadUrl,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -494,7 +494,7 @@ void main() {
|
||||
|
||||
test('throws an exception if the upload fails', () async {
|
||||
const artifactId = 42;
|
||||
const uploadUrl = 'https://example.com/artifact.zip';
|
||||
const uploadUrl = 'https://example.com';
|
||||
when(() => httpClient.send(any())).thenAnswer((_) async {
|
||||
return http.StreamedResponse(
|
||||
Stream.value(
|
||||
@@ -507,7 +507,7 @@ void main() {
|
||||
platform: platform,
|
||||
hash: hash,
|
||||
size: size,
|
||||
uploadUrl: uploadUrl,
|
||||
url: uploadUrl,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -550,7 +550,7 @@ void main() {
|
||||
|
||||
test('completes when request succeeds', () async {
|
||||
const artifactId = 42;
|
||||
const uploadUrl = 'https://example.com/artifact.zip';
|
||||
const uploadUrl = 'https://example.com';
|
||||
when(() => httpClient.send(any())).thenAnswer((_) async {
|
||||
return http.StreamedResponse(
|
||||
Stream.value(
|
||||
@@ -563,7 +563,7 @@ void main() {
|
||||
platform: platform,
|
||||
hash: hash,
|
||||
size: size,
|
||||
uploadUrl: uploadUrl,
|
||||
url: uploadUrl,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ class CreatePatchArtifactResponse {
|
||||
required this.platform,
|
||||
required this.hash,
|
||||
required this.size,
|
||||
required this.uploadUrl,
|
||||
required this.url,
|
||||
});
|
||||
|
||||
/// Converts a Map<String, dynamic> to a [CreatePatchArtifactResponse]
|
||||
@@ -45,5 +45,5 @@ class CreatePatchArtifactResponse {
|
||||
final int size;
|
||||
|
||||
/// The upload URL for the artifact.
|
||||
final String uploadUrl;
|
||||
final String url;
|
||||
}
|
||||
|
||||
+3
-3
@@ -21,11 +21,11 @@ CreatePatchArtifactResponse _$CreatePatchArtifactResponseFromJson(
|
||||
platform: $checkedConvert('platform', (v) => v as String),
|
||||
hash: $checkedConvert('hash', (v) => v as String),
|
||||
size: $checkedConvert('size', (v) => v as int),
|
||||
uploadUrl: $checkedConvert('upload_url', (v) => v as String),
|
||||
url: $checkedConvert('url', (v) => v as String),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
fieldKeyMap: const {'patchId': 'patch_id', 'uploadUrl': 'upload_url'},
|
||||
fieldKeyMap: const {'patchId': 'patch_id'},
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreatePatchArtifactResponseToJson(
|
||||
@@ -37,5 +37,5 @@ Map<String, dynamic> _$CreatePatchArtifactResponseToJson(
|
||||
'platform': instance.platform,
|
||||
'hash': instance.hash,
|
||||
'size': instance.size,
|
||||
'upload_url': instance.uploadUrl,
|
||||
'url': instance.url,
|
||||
};
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ class CreateReleaseArtifactResponse {
|
||||
required this.platform,
|
||||
required this.hash,
|
||||
required this.size,
|
||||
required this.uploadUrl,
|
||||
required this.url,
|
||||
});
|
||||
|
||||
/// Converts a Map<String, dynamic> to a [CreateReleaseArtifactResponse]
|
||||
@@ -45,5 +45,5 @@ class CreateReleaseArtifactResponse {
|
||||
final int size;
|
||||
|
||||
/// The upload URL for the artifact.
|
||||
final String uploadUrl;
|
||||
final String url;
|
||||
}
|
||||
|
||||
+3
-3
@@ -21,11 +21,11 @@ CreateReleaseArtifactResponse _$CreateReleaseArtifactResponseFromJson(
|
||||
platform: $checkedConvert('platform', (v) => v as String),
|
||||
hash: $checkedConvert('hash', (v) => v as String),
|
||||
size: $checkedConvert('size', (v) => v as int),
|
||||
uploadUrl: $checkedConvert('upload_url', (v) => v as String),
|
||||
url: $checkedConvert('url', (v) => v as String),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
fieldKeyMap: const {'releaseId': 'release_id', 'uploadUrl': 'upload_url'},
|
||||
fieldKeyMap: const {'releaseId': 'release_id'},
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreateReleaseArtifactResponseToJson(
|
||||
@@ -37,5 +37,5 @@ Map<String, dynamic> _$CreateReleaseArtifactResponseToJson(
|
||||
'platform': instance.platform,
|
||||
'hash': instance.hash,
|
||||
'size': instance.size,
|
||||
'upload_url': instance.uploadUrl,
|
||||
'url': instance.url,
|
||||
};
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ void main() {
|
||||
platform: 'android',
|
||||
hash: '1234',
|
||||
size: 9876,
|
||||
uploadUrl: 'https://example.com',
|
||||
url: 'https://example.com',
|
||||
);
|
||||
expect(
|
||||
CreatePatchArtifactResponse.fromJson(request.toJson()).toJson(),
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ void main() {
|
||||
platform: 'android',
|
||||
hash: '1234',
|
||||
size: 9876,
|
||||
uploadUrl: 'https://example.com',
|
||||
url: 'https://example.com',
|
||||
);
|
||||
expect(
|
||||
CreateReleaseArtifactResponse.fromJson(response.toJson()).toJson(),
|
||||
|
||||
Reference in New Issue
Block a user