0

I've got an http request from within swift to google cloud functions/node.js using alamofire:

 Alamofire.request(url, method: .post, parameters: [
            "api_version": apiVersion,
            ])

I know the request is hitting the server and executing the function on the server because i print out a log message that i'm in the function.

I also know that the apiVersion on the client contains data which is a stripe api version.

But on the server in this function:

exports.ephemeral_keys = functions.https.onRequest((req, res) => {

console.log("activated ephemeral keys") // prints to the console

const stripe_version = req.query.api_version //is undefined

console.log(stripe_version) is logging undefined.

Any ideas?

****** Update *********

I took a look at this post and I suspect there is an encoding issue but advice would be sweet.

How to add Alamofire URL parameters

Thanks.

Mike
  • 1,281
  • 3
  • 14
  • 41

1 Answers1

1

Would this work?

Alamofire.request(url, 
                  method: .post, 
                  parameters: ["api_version": apiVersion], 
                  encoding: URLEncoding(destination: .queryString))
jonaszmclaren
  • 2,459
  • 20
  • 30