Categories
Mastering Development

2 API Calls in One JavaScript

presently I am attempting to make 2 different api calls one after the other within 1 java/nodejs script. It seems after my first function runs successfully, the second one errors with the following: FetchError: request to failed, reason: socket hang up; type: ‘system’, errno: ‘ECONNRESET’, code: ‘ECONNRESET’ Below is a code snippet of what I […]

Categories
Mastering Development

Pass object to Express export function

I’m working (and learning) on my TypeScript skills, although I ran into a problem: I have a class named Manager which contains and manages multiple ‘sub’ managers. In the index file, I load the Manager by creating an instance and calling the load function. When loading all ‘sub’ managers get a reference to the main/only […]

Categories
Development

How to upload image to aws pre signed url as multipart data using Alamofire 5?

I am trying to upload an image to the pre-signed AWS URL. I tried with Alamofire 5 upload method which accepts multipartData. I am getting a 403 error with Alamofire 5 multipart upload. When I try with URLSession it is working properly. /// Working code var request: URLRequest = URLRequest(url: requestURL) request.httpMethod = “PUT” request.httpBody […]

Categories
Development

Can we have more than one key value for method in RequestLogger for testcafe

const logger = RequestLogger({url : /.*/, method : ‘PUT’},{ logResponseHeaders: true, logResponseBody: true, logRequestHeaders: true, logRequestBody: true, stringifyRequestBody: true, stringifyResponseBody: true }); The above code is fine. But what if we have more than one method value like PUT,POST,PATCH etc? I tried something like const logger = RequestLogger({url : /.*/, method : {‘PUT’,’POST’}} but it […]

Categories
Cache Development

AWS CloudWatch Insights query field with hyphen in name

Trying to run CloudWatch Insights query containing reqHeaders.x-forwarded-for, like fields @timestamp, status, err, method, url, req_id, reqHeaders.x-forwarded-for | filter status >= 400 | sort @timestamp desc | limit 10 but this field is always empty despite it was properly parsed in @message. I suspect this is because of hyphens in subfield name. Does anybody know […]

Categories
Development

How to make a Haml form with two conditional actions

On submit this form will call the put action on the controller: .panel-body{style: ‘background:#0E0D0D;’} =form_for @payment, method: :put, html: {id: ‘edit_bank_detail’} do |f| .row.text_white .form-group.col-lg-12 =f.label :paypal_email_address =f.email_field ‘user_paypal_email’,class: ‘form-control’ .row.text-center .form-group.col-lg-12 =f.submit ‘Submit’, class: ‘btn btn-primary text_black’,data: { disable_with: “Please wait…” } I need it to call the put or create action based on […]

Categories
Development

How to make a Haml form with two conditional actions

On submit this form will call the put action on the controller: .panel-body{style: ‘background:#0E0D0D;’} =form_for @payment, method: :put, html: {id: ‘edit_bank_detail’} do |f| .row.text_white .form-group.col-lg-12 =f.label :paypal_email_address =f.email_field ‘user_paypal_email’,class: ‘form-control’ .row.text-center .form-group.col-lg-12 =f.submit ‘Submit’, class: ‘btn btn-primary text_black’,data: { disable_with: “Please wait…” } I need it to call the put or create action based on […]

Categories
Development Java Javascript

JavaScript fetch request body parameters not received

Context: I am trying to send a put request to a server using JavaScript and fetch from an html file I’m writing. Problem: The request I made is working in Insomnia, but when I try to send it from an html it isn’t properly received. The code was generated by Insomnia also. When I send […]

Categories
Development

Cypress not mocking network requests

I’ve been staring at the Cypress docs for an hour but I still can’t get this mocking to work: settings.actions.ts try { // make the request console.log(startMsg); const resp = await fetch(urls.SETTINGS_PUT_HTTP, { method: ‘PUT’, headers: { ‘Content-Type’: ‘application/json;charset=utf-8’ }, body: JSON.stringify(payload) }); const res = await resp.json(); console.log(resp); if (res.status) { // if we […]

Categories
AJAX ASP.NET Development MVC

PUT Ajax request returning 404 not found asp.net MVC

I am new to asp.net MVC, I am making one project just like stack overflow. In this, I just want to use the ajax system to upvote or down-vote the answer. So, I can show the counter increase and decrease without refreshing the page. I have default scaffolding one controller of Question in the controller […]