Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nuxt/http

Package Overview
Dependencies
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxt/http - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

8

CHANGELOG.md

@@ -5,2 +5,10 @@ # Changelog

### [0.5.2](https://github.com/nuxt/http/compare/v0.5.1...v0.5.2) (2020-06-05)
### Features
* allow adding custom headers with nuxt config ([#101](https://github.com/nuxt/http/issues/101)) ([2839260](https://github.com/nuxt/http/commit/2839260ea97b18f259f79bb3ea0e97b0aa7228c3))
* support baseUrl and remove port :443 and :80 when http or https ([#103](https://github.com/nuxt/http/issues/103)) ([fc3e78e](https://github.com/nuxt/http/commit/fc3e78e1307455df506dbc8f6ba5269f28f6e364))
### [0.5.1](https://github.com/nuxt/http/compare/v0.5.0...v0.5.1) (2020-04-29)

@@ -7,0 +15,0 @@

22

lib/module.js

@@ -37,6 +37,13 @@ const path = require('path')

// Support baseUrl
if (moduleOptions.baseUrl && !moduleOptions.baseURL) {
moduleOptions.baseURL = moduleOptions.baseUrl
delete moduleOptions.baseUrl
}
// Apply defaults
const options = {
baseURL: `http://${defaultHost}:${defaultPort}${prefix}`,
browserBaseURL: null,
browserBaseURL: undefined,
proxyHeaders: true,

@@ -49,2 +56,3 @@ proxyHeadersIgnore: ['accept', 'host', 'cf-ray', 'cf-connecting-ip', 'content-length'],

https: false,
headers: {},
...moduleOptions

@@ -66,3 +74,3 @@ }

// Default browserBaseURL
if (!options.browserBaseURL) {
if (typeof options.browserBaseURL === 'undefined') {
options.browserBaseURL = options.proxy ? prefix : options.baseURL

@@ -82,2 +90,12 @@ }

// Remove port 443 when https
if (options.baseURL.includes('https://')) {
options.baseURL = options.baseURL.replace(':443', '')
}
// Remove port 80 when http
if (options.baseURL.includes('http://')) {
options.baseURL = options.baseURL.replace(':80', '')
}
// Convert http:// to https:// if https option is on

@@ -84,0 +102,0 @@ if (options.https === true) {

20

lib/plugin.js

@@ -14,3 +14,2 @@ import KY from 'ky-universal'

setBaseURL (baseURL) {

@@ -30,3 +29,3 @@ this._defaults.prefixUrl = baseURL

const value = !token ? null : (type ? type + ' ' : '') + token
this.setHeader('authorization', value)
this.setHeader('Authorization', value)
}

@@ -90,3 +89,3 @@

url = url.substr(1)
}
}

@@ -117,2 +116,4 @@ try {

const headers = <%= JSON.stringify(options.headers, null, 2) %>
// Defaults

@@ -123,3 +124,3 @@ const defaults = {

prefixUrl,
headers: {}
headers
}

@@ -129,5 +130,10 @@

// Proxy SSR request headers headers
defaults.headers = (ctx.req && ctx.req.headers) ? { ...ctx.req.headers } : {}
<% for (let h of options.proxyHeadersIgnore) { %>delete defaults.headers['<%= h %>']
<% } %><% } %>
if (process.server && ctx.req && ctx.req.headers) {
const reqHeaders = { ...ctx.req.headers }
for (let h of <%= serialize(options.proxyHeadersIgnore) %>) {
delete reqHeaders[h]
}
defaults.headers = { ...reqHeaders, ...defaults.headers }
}
<% } %>

@@ -134,0 +140,0 @@ if (process.server) {

{
"name": "@nuxt/http",
"version": "0.5.1",
"version": "0.5.2",
"description": "Universal HTTP Module for Nuxt.js",

@@ -21,6 +21,6 @@ "repository": "nuxt/http",

"dependencies": {
"@nuxtjs/proxy": "^1.3.3",
"consola": "^2.11.3",
"ky": "^0.19.1",
"ky-universal": "^0.6.0",
"@nuxtjs/proxy": "^2.0.0",
"consola": "^2.12.2",
"ky": "^0.20.0",
"ky-universal": "^0.7.0",
"semver": "^7.3.2"

@@ -27,0 +27,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc