src/builder.js
/**
     * Build the value for the source field of the CloudEvent,
     * depending on the plugin configuration of options
     * `serverUrlMode`, `serverUrl`,
     * and the uri part of the current request.
     * Note that this is mainly for usage inside the plugin,
     * but in some cases could be useful even outside.
     *
     * @param {string} [url='']  the uri part of the current request
     * @return {string} the source value to use, as a string
     * @private
     */
Build the value for the source field of the CloudEvent,
depending on the plugin configuration of options
`serverUrlMode`, `serverUrl`,
and the uri part of the current request.
Note that this is mainly for usage inside the plugin,
but in some cases could be useful even outside.

@param {string} [url='']  the uri part of the current request
@return {string} the source value to use, as a string
@private
Build the value for the source field of the CloudEvent depending on the plugin configuration of options ` serverUrlMode ` ` serverUrl ` and the uri part of the current request . Note that this is mainly for usage inside the plugin but in some cases could be useful even outside . @param { string } [ url = ' ' ] the uri part of the current request @return { string } the source value to use as a string @private
buildSourceUrl (url = '') {
      let sourceUrl
      switch (serverUrlMode) {
        case null:
        case 'pluginAndRequestSimplified':
          sourceUrl = serverUrl + CloudEventTransformer.uriStripArguments(url)
          break
        case 'pluginAndRequestUrl':
          sourceUrl = serverUrl + url
          break
        case 'pluginServerUrl':
          sourceUrl = serverUrl
          break
        case 'requestUrl':
          sourceUrl = url
          break
        default:
          throw new Error(`Illegal value for serverUrlMode: '${serverUrlMode}'`)
      }
      return sourceUrl
    }
buildSourceUrl ( url = '' ) { let sourceUrl switch ( serverUrlMode ) { case null : case 'pluginAndRequestSimplified' : sourceUrl = serverUrl + CloudEventTransformer . uriStripArguments ( url ) break case 'pluginAndRequestUrl' : sourceUrl = serverUrl + url break case 'pluginServerUrl' : sourceUrl = serverUrl break case 'requestUrl' : sourceUrl = url break default : throw new Error ( ` ${ serverUrlMode } ` ) } return sourceUrl }
Build the value for the source field of the CloudEvent,
 depending on the plugin configuration of options
 `serverUrlMode`, `serverUrl`,
 and the uri part of the current request.
Build the value for the source field of the CloudEvent depending on the plugin configuration of options ` serverUrlMode ` ` serverUrl ` and the uri part of the current request .