Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove AWS-specfic default user agent #234

Merged
merged 1 commit into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ final class RuntimeConfigGenerator {
writer.addImport("toUtf8", "toUtf8",
TypeScriptDependency.AWS_SDK_UTIL_UTF8_NODE.packageName);
writer.write("utf8Encoder: toUtf8,");
},
"defaultUserAgent", writer -> {
writer.addDependency(TypeScriptDependency.AWS_SDK_UTIL_USER_AGENT_NODE);
writer.addImport("defaultUserAgent", "defaultUserAgent",
TypeScriptDependency.AWS_SDK_UTIL_USER_AGENT_NODE.packageName);
writer.addDefaultImport("packageInfo", "./package.json");
writer.write("defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),");
}
);
private final Map<String, Consumer<TypeScriptWriter>> browserRuntimeConfigDefaults = MapUtils.of(
Expand Down Expand Up @@ -157,13 +150,6 @@ final class RuntimeConfigGenerator {
writer.addImport("toUtf8", "toUtf8",
TypeScriptDependency.AWS_SDK_UTIL_UTF8_BROWSER.packageName);
writer.write("utf8Encoder: toUtf8,");
},
"defaultUserAgent", writer -> {
writer.addDependency(TypeScriptDependency.AWS_SDK_UTIL_USER_AGENT_BROWSER);
writer.addImport("defaultUserAgent", "defaultUserAgent",
TypeScriptDependency.AWS_SDK_UTIL_USER_AGENT_BROWSER.packageName);
writer.addDefaultImport("packageInfo", "./package.json");
writer.write("defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),");
}
);
private final Map<String, Consumer<TypeScriptWriter>> reactNativeRuntimeConfigDefaults = MapUtils.of(
Expand All @@ -178,11 +164,6 @@ final class RuntimeConfigGenerator {
writer.addImport("parseUrl", "parseUrl",
TypeScriptDependency.AWS_SDK_URL_PARSER_NODE.packageName);
writer.write("urlParser: parseUrl,");
},
"defaultUserAgent", writer -> {
writer.addDefaultImport("packageInfo", "./package.json");
writer.write("defaultUserAgent: "
+ "`aws-sdk-js-v3-react-native-$${packageInfo.name}/$${packageInfo.version}`,");
}
);
private final Map<String, Consumer<TypeScriptWriter>> sharedRuntimeConfigDefaults = MapUtils.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@ private void generateClientDefaults() {
writer.writeDocs("The function that will be used to convert binary data to a UTF-8 encoded string");
writer.write("utf8Encoder?: __Encoder;\n");

writer.writeDocs("The string that will be used to populate default value in 'User-Agent' header");
writer.write("defaultUserAgent?: string;\n");

writer.writeDocs("The runtime environment");
writer.write("runtime?: string;\n");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ public enum TypeScriptDependency implements SymbolDependencyContainer {
AWS_SDK_UTIL_BODY_LENGTH_BROWSER("dependencies", "@aws-sdk/util-body-length-browser", "1.0.0-rc.0", true),
AWS_SDK_UTIL_BODY_LENGTH_NODE("dependencies", "@aws-sdk/util-body-length-node", "1.0.0-rc.0", true),

AWS_SDK_UTIL_USER_AGENT_BROWSER("dependencies", "@aws-sdk/util-user-agent-browser", "1.0.0-rc.0", true),
AWS_SDK_UTIL_USER_AGENT_NODE("dependencies", "@aws-sdk/util-user-agent-node", "1.0.0-rc.0", true),

AWS_SDK_UTIL_UTF8_BROWSER("dependencies", "@aws-sdk/util-utf8-browser", "1.0.0-rc.0", true),
AWS_SDK_UTIL_UTF8_NODE("dependencies", "@aws-sdk/util-utf8-node", "1.0.0-rc.0", true),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,20 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(

// Does the runtimeConfig.ts file expand the template properties properly?
String runtimeConfigContents = manifest.getFileString("runtimeConfig.ts").get();
assertThat(runtimeConfigContents, containsString("import packageInfo from \"./package.json\""));
assertThat(runtimeConfigContents,
containsString("import { ClientDefaults } from \"./ExampleClient\";"));
assertThat(runtimeConfigContents, containsString("syn: 'ack2',"));
assertThat(runtimeConfigSharedContents, containsString("foo: 'bar',"));

// Does the runtimeConfig.browser.ts file expand the template properties properly?
String runtimeConfigBrowserContents = manifest.getFileString("runtimeConfig.browser.ts").get();
assertThat(runtimeConfigContents, containsString("import packageInfo from \"./package.json\""));
assertThat(runtimeConfigBrowserContents,
containsString("import { ClientDefaults } from \"./ExampleClient\";"));
assertThat(runtimeConfigContents, containsString("syn: 'ack2',"));
assertThat(runtimeConfigSharedContents, containsString("foo: 'bar',"));

// Does the runtimeConfig.native.ts file expand the browser template properties properly?
String runtimeConfigNativeContents = manifest.getFileString("runtimeConfig.native.ts").get();
assertThat(runtimeConfigContents, containsString("import packageInfo from \"./package.json\""));
assertThat(runtimeConfigNativeContents,
containsString("import { ClientDefaults } from \"./ExampleClient\";"));
assertThat(runtimeConfigNativeContents,
Expand Down