Response headers

2023-7-13 Less than 1 minute

PHit F12 to access Developer Tools and view the console logs.

# Mock data file

/**
 * @url https://www.api.com/headers
 * @method get
 * @header application: application/json
 * @header abc: 123
 * @header xyz: aaa
 * @header xyz: bbb
 */
module.exports = 'response headers mocking';

# Vue code

<template>
  <div class="demo">
    <button @click="get">GET https://www.api.com/headers</button>
    <div class="result"> {{ msg }} </div>
    <div class="tips">PHit F12 to access Developer Tools and view the console logs.</div>
  </div>
</template>

<script>
import axios from 'axios';
export default {
  data() {
    return { msg: '' }
  },
  methods: {
    get() {
      axios.get('https://www.api.com/headers').then(res => {
        this.msg = JSON.stringify(res.headers);
      });
    },
  }
}
</script>
<style scoped src="./demo.css">
Last update: July 13, 2023 22:53