Activities

usb248

usb248 posted a new question

http •

usb248

usb248 posted a new feature request

http •

idea Integrate retry functionnality like axios-retry

What problem does this feature solve?

What does the proposed changes look like?

Something like this :

httpRetry($http, {
        retries: 2,
        retryDelay: httpRetry.exponentialDelay,
        retryCondition : function(err){
            return err.status >= 400 && err.data.hasOwnProperty('retry') && err.data.retry
        }
    })
usb248

usb248 posted a new question

http •

Integrate retry functionnality like axios-retry

Possible ?

acrolink

acrolink posted a new bug report

http •

bug $http is undefined in async asyncData method in production (nuxt build && nuxt start)

Version

v0.3.5

Reproduction link

https://jsfiddle.net/yqr9s70a/

Steps to reproduce

The following code works perfect in development (nuxt script):

  async asyncData({ $http }) {
    let response = await $axios.get(`/api/items`)
    return { entities: response.data.data }
  }

However, in production (nuxt build && nuxt start) I get this error:

ERROR Cannot read property '$get' of undefined 07:59:22

  at asyncData (df028d49c11282eafe57.js:1:0)
  at C (server.js:1:0)
  at Promise.all.h.map.n (server.js:1:0)
  at Array.map (<anonymous>)
  at e.default (server.js:1:0)

What is expected ?

To work in production as it does on development

What is actually happening?

Error

beeplove

beeplove posted a new question

http •

Header name 'authorization' vs 'Authorization'

Just curious why this team has chosen 'authorization' instead of very typical 'Authorization'

https://github.com/nuxt/http/blob/dev/lib/plugin.js#L23

emuter

emuter posted a new question

http •

not able to set custom header Content-Type on post requests

not able to set custom header Content-Type on post requests

happycoder97

happycoder97 posted a new bug report

http •

bug Build fails with typescript

Version

v0.3.2

Reproduction link

https://github.com/happycoder97/nuxt-http-typescript-bug1-repro

Steps to reproduce

Just run yarn dev

What is expected ?

App compiles successfully.

What is actually happening?

Typechecking fails.

happycoder97

happycoder97 posted a new question

http •

Unable to compile nuxt app due to error in `@nuxt/http`
 ERROR  ERROR in /<..snip..>/project/node_modules/@nuxt/http/types/index.d.ts                                                        15:28:35
2:85 Module '"../../../ky"' has no exported member 'JSONValue'.
    1 | import Vue from 'vue'
  > 2 | import { ResponsePromise, Options, BeforeRequestHook, AfterResponseHook, HTTPError, JSONValue } from 'ky'
      |                                                                                     ^
    3 | import './vuex'
    4 | 
    5 | type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

ℹ Version: typescript 3.5.2              
                                                                                          

From yarn.lock:

@nuxt/[email protected]^0.3.2
[email protected]^0.11.0
pimlie

pimlie posted a new feature request

http •

idea change browserBaseUrl default value to '/'

What problem does this feature solve?

Currently the default value of browserBaseUrl is baseUrl which works correctly if you are running your server on localhost as well. But when running Nuxt with HOST=0.0.0.0 then baseUrl and thus browseBaseUrl still fallbacks to localhost. This is fine for baseUrl, but browserBaseUrl shouldnt probably be pointing to localhost.

Related issue: https://github.com/nuxt/press/issues/2 (as fix in nuxtpress I just added browserBaseUrl: '/' as option)

What does the proposed changes look like?

Set default value for browserBaseUrl to /

jefrydco

jefrydco posted a new feature request

http •

idea Integrate Nuxt Progress Bar

What problem does this feature solve?

Nuxt HTTP documentation states that this module isn't integrated yet with nuxt progress bar because of this https://github.com/sindresorhus/ky/pull/34 isn't merged. But now it has merged.

What does the proposed changes look like?

Integrate nuxt progress bar

tony19

tony19 posted a new question

http •

Using $http in asyncData with vue-property-decorator

Following the @nuxt/http usage guide, I added { $http } to the arguments of asyncData in my Nuxt TypeScript project:

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import Post from '~/models/Post'

@Component({
  components: {
    PostPreview: () => import('~/components/PostPreview.vue')
  },
  async asyncData({ $http }) {
    const { data } = await $http.get(`https://my-api/posts`)
    return {
      posts: data
    }
  }
})
export default class FeedPage extends Vue {
  posts: Post[] = []
}
</script>

but it causes a TypeScript error:

Property '$http' does not exist on type 'Context'.

Screen Shot 2019-05-28 at 10.12.46 AM.png

Screen Shot 2019-05-28 at 10.14.56 AM.png

bovas85

bovas85 posted a new bug report

http •

bug Cannot generate dynamic routes with nuxt generate

Version

^0.1.2

Reproduction link

https://github.com/bovas85/nunziellasalluce.com

Steps to reproduce

Clone the repo
yarn
yarn generate

axios is not being used, ky is used instead which fails after timing out

What is expected ?

axios is used in nuxt.config as per imported

What is actually happening?

axios is not being used, ky is used instead which fails after timing out

Lisiadito

Lisiadito posted a new question

http •

import of type for JSONValue missing

Using the @nuxt/http module with TypeScript leads to an error Cannot find name JSONValue
The type JSONValue must be imported from ky.

I can't open an issue via CMTY because the link is not working.

pi0

pi0 posted a new question

http •

allow creating new instances

Advanced use case. Inside a plugin create a new instance for multi baseURL or custom headers support.

plugins/http.js

export default function ({ $http }, inject) {
  inject('blog', $http.create({
    baseURL: 'http://blog.mywebsite.com/api'
  }))
}