diff --git a/CHANGELOG.md b/CHANGELOG.md index 492d9270f..0bccbb1fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [build] Bumped electron version to v4.1.1 and updated .dmg installer background image in PR [1419](https://github.com/Microsoft/BotFramework-Emulator/pull/1419) - [ui-react] Added default disabled styling to checkbox control in PR [1424](https://github.com/Microsoft/BotFramework-Emulator/pull/1424) +## Removed +- [main] Removed custom user agent string from outgoing requests in PR [1427](https://github.com/Microsoft/BotFramework-Emulator/pull/1427) + ## v4.3.3 - 2019 - 03 - 14 ## Fixed - [client] Use correct casing for user id prop for web chat in PR [#1374](https://github.com/Microsoft/BotFramework-Emulator/pull/1374) diff --git a/packages/app/main/src/appendCustomUserAgent.spec.ts b/packages/app/main/src/appendCustomUserAgent.spec.ts deleted file mode 100644 index e5233f0b6..000000000 --- a/packages/app/main/src/appendCustomUserAgent.spec.ts +++ /dev/null @@ -1,58 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. -// -// Microsoft Bot Framework: http://botframework.com -// -// Bot Framework Emulator Github: -// https://github.com/Microsoft/BotFramwork-Emulator -// -// Copyright (c) Microsoft Corporation -// All rights reserved. -// -// MIT License: -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -import { appendCustomUserAgent } from './appendCustomUserAgent'; - -const mockVersion = 'v4.5.6'; -jest.mock('electron', () => ({ - app: { - getVersion: () => mockVersion, - }, -})); - -it('should append a custom user agent to outgoing requests', () => { - const mockDetails = { - requestHeaders: { - 'User-Agent': 'some/user/agent', - }, - }; - const callBack = jest.fn((...args: any[]) => null); - appendCustomUserAgent(mockDetails, callBack); - - expect(callBack).toHaveBeenCalledWith({ - cancel: false, - requestHeaders: { - 'User-Agent': `some/user/agent botbuilder/emulator/${mockVersion}`, - }, - }); -}); diff --git a/packages/app/main/src/appendCustomUserAgent.ts b/packages/app/main/src/appendCustomUserAgent.ts deleted file mode 100644 index 2f9711e35..000000000 --- a/packages/app/main/src/appendCustomUserAgent.ts +++ /dev/null @@ -1,43 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. -// -// Microsoft Bot Framework: http://botframework.com -// -// Bot Framework Emulator Github: -// https://github.com/Microsoft/BotFramwork-Emulator -// -// Copyright (c) Microsoft Corporation -// All rights reserved. -// -// MIT License: -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -import * as Electron from 'electron'; - -export function appendCustomUserAgent(details: any, callback: (...args: any[]) => any): void { - const { requestHeaders = {} } = details; - const version = Electron.app.getVersion(); - - requestHeaders['User-Agent'] += ` botbuilder/emulator/${version}`; - - callback({ cancel: false, requestHeaders }); -} diff --git a/packages/app/main/src/main.ts b/packages/app/main/src/main.ts index 6435318fd..d142d7e79 100644 --- a/packages/app/main/src/main.ts +++ b/packages/app/main/src/main.ts @@ -41,7 +41,6 @@ import { app, BrowserWindow, dialog, ipcMain, Rectangle, screen, systemPreferenc import { UpdateInfo } from 'electron-updater'; import { Store } from 'redux'; -import { appendCustomUserAgent } from './appendCustomUserAgent'; import { AppMenuBuilder } from './appMenuBuilder'; import { AppUpdater } from './appUpdater'; import { getStore } from './botData/store'; @@ -298,9 +297,6 @@ const createMainWindow = async () => { }) ); - // attach custom user agent string - mainWindow.webContents.session.webRequest.onBeforeSendHeaders(appendCustomUserAgent); - // get reference to bots list in state for comparison against state changes let botsRef = store.getState().bot.botFiles;