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

User-Agent version is incorrect #65

Open
TrevinAvery opened this issue Dec 1, 2021 · 3 comments
Open

User-Agent version is incorrect #65

TrevinAvery opened this issue Dec 1, 2021 · 3 comments
Labels
good first issue Great issue to get started contributing help wanted Something we need help with

Comments

@TrevinAvery
Copy link

The version number for the default User-Agent header is hardcoded, and is currently out of date. It may be worth auto-updating this value during the build to match the value in the package.json file.

https://github.com/byu-imaal/dohjs/blob/ecf8077e628db214c183ebbedb10f17e83cde045/lib/index.js#L165

@kimbo
Copy link
Contributor

kimbo commented Dec 2, 2021

Thank you for reporting this, it's an excellent idea.

@kimbo kimbo added good first issue Great issue to get started contributing help wanted Something we need help with labels Dec 2, 2021
@TrevinAvery
Copy link
Author

If you want to use webpack, you could solve this issue with the DefinePlugin.

dohjs/webpack.config.js

const webpack = require('webpack')
const package = require('./package.json')

module.exports = {
	plugins: [
		new webpack.DefinePlugin({
			__VERSION__: JSON.stringify(package.version),
		}),
	],
}

dohjs/lib/index.js

'User-Agent': `dohjs/${__VERSION__}`

@kimbo
Copy link
Contributor

kimbo commented Dec 6, 2021

@TrevinAvery I haven't mucked about with webpack much, but that seems like a reasonable fix to me.

Also, I believe we could replace our current build process that uses browserify with webpack. That's a separate issue, but if you're interested in tackling that as well, I think we'd welcome that change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Great issue to get started contributing help wanted Something we need help with
Projects
None yet
Development

No branches or pull requests

2 participants