steamutils 1.1.83 → 1.1.85

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +16 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1564,13 +1564,19 @@ class SteamUser {
1564
1564
  checkTooManyRequest = true
1565
1565
  await sleep(30000)
1566
1566
  } else if (response.status === 401) {
1567
- console.log('Unauthorized')
1567
+ console.log('Unauthorized', config.url)
1568
1568
  if (params.method.toUpperCase() === 'POST') {
1569
1569
  config.headers['Content-Type'] = config.headers['content-type'] = 'multipart/form-data'
1570
1570
  retry = 1
1571
1571
  }
1572
+ } else if (response.status === 400) {
1573
+ console.log('Error', response.status, config.url)
1574
+ if (params.method.toUpperCase() === 'POST') {
1575
+ config.headers['Content-Type'] = config.headers['content-type'] = 'application/x-www-form-urlencoded'
1576
+ retry = 1
1577
+ }
1572
1578
  } else {
1573
- console.log(response.status);
1579
+ console.log(response.status, config.url);
1574
1580
  }
1575
1581
  }
1576
1582
  return response
@@ -2645,12 +2651,15 @@ class SteamUser {
2645
2651
 
2646
2652
  //{ invited: [ '76561199277912057' ], success: 1 }
2647
2653
  async addFriendUser (steamID) {
2648
- const { data } = await this._httpRequest({
2654
+ const { data } = await this._httpRequestAjax({
2649
2655
  url: `actions/AddFriendAjax`,
2650
2656
  data: {
2651
2657
  steamid: steamID,
2652
2658
  accept_invite: 0,
2653
2659
  },
2660
+ headers: {
2661
+ 'content-type': 'application/x-www-form-urlencoded'
2662
+ },
2654
2663
  method: 'POST',
2655
2664
  })
2656
2665
 
@@ -2659,11 +2668,14 @@ class SteamUser {
2659
2668
 
2660
2669
  //true, false boolean
2661
2670
  async removeFriend (steamID) {
2662
- const { data } = await this._httpRequest({
2671
+ const { data } = await this._httpRequestAjax({
2663
2672
  url: `actions/RemoveFriendAjax`,
2664
2673
  data: {
2665
2674
  steamid: steamID,
2666
2675
  },
2676
+ headers: {
2677
+ 'content-type': 'application/x-www-form-urlencoded'
2678
+ },
2667
2679
  method: 'POST',
2668
2680
  })
2669
2681
  return data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.1.83",
3
+ "version": "1.1.85",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.3.4",